首页 > 技术文章 > ie下web常见错误和差异及解决方案

ericyuan 2014-11-17 10:31 原文

区分ie6~8

         IE6   IE7    IE8   FF2   FF3    Opera9.5 
>property    Y——     Y——     Y——     N——     N——     N         ??  貌似无效
.property    Y——     Y——     Y——     N——     N——     N         ??  …………
value\9     Y—— Y—— Y—— N—— N—— N  
*property    Y——  Y——  N——  N——  N——  N
_property    Y——  N——  N——  N——  N——  N
!important    N——  Y——  Y——  Y——  Y——  Y

 

html条件注释区分ie各种浏览器(除IE外所有浏览器无法识别,全部转换成注释)

<!--[if lte IE 6]>
html code
<![endif]–> 

 

ie6不支持 A > B 子选择器

 

$('.searchtext1').on({
  focus: function () {xx},
  blur: function () {xx}  //ie6此处不能有逗号
})

 

ie6 js无法解析trim()方法

增加一段js代码

String.prototype.trim = function () {
  return this.replace(/^\s\s*/, '' ).replace(/\s\s*$/, '' );
}

 

解决ie6,ie7不支持display:inline-block;

增加样式 *display:inline; *zoom:1;

 

IE ,ff,chrome 下input光标向上偏离

可以用 \9 方法来解决: ie下input line-height要设置数值。chrome下line-height:normal;

推荐阅读