ie-hack

1, IE条件注释法,微软官方推荐的hack方式。
只在IE下生效 <!--[if IE]> 这段文字只在IE浏览器上显示 <![endif]--> 只在IE6下生效 <!--[if IE 6]> 这段文字只在IE6浏览器上显示 <![endif]--> 只在IE6以上版本生效 <!--[if gt IE 6]> 这段文字只在IE6以上版本IE浏览器上显示 <![endif]--> 只在IE7上不生效 <!--[if ! IE 7]> 这段文字在非IE7浏览器上显示 <![endif]--> 非IE浏览器生效 <!--[if !IE]><!--> 这段文字只在非IE浏览器上显示 <!--<![endif]-->

2, 选择符前缀法,即在CSS选择符前加一些只有特定浏览器才能识别的前缀。

*html 前缀只对IE6生效
*+html 前缀只对IE7生效

例如:
.test{ color:#FFF;}
*html .test{ color:#000;}  /* only for ie6 */
*+html .test{ color:#CCC;} /* only for ie7 */

3, 属性前缀法,即在样式属性名前加一些只有特定浏览器才能识别的前缀。

“_” 只对IE6生效
“*” 只对IE6和IE7生效

例如:
.test{ color:#FFF; *color:#CCC; _color:#000;}

4, 还有一种hack方法是在属性值后加上一些只有特定浏览器才能识别的前缀。

“9″  IE6/IE7/IE8/IE9/IE10都生效
“″  IE8/IE9/IE10都生效
“9″ 只对IE9/IE10生效
例如:
.test{ color:#FFF; color:#CCC9; color:#3FC;}

5.button重置css样式兼容ie6,ie7

button在IE6、IE7下的兼容性,需要充值css为overflow:visible

转载

6.让IE6支持max-width,min-width

.sector{max-500px; _expression((documentElement.clientWidth>500)?”500px”:”auto”);

min-300px; _expression((documentElement.clientWidth<300)?”300px”:”auto”);}

原文地址:https://www.cnblogs.com/woohblog/p/3325387.html