IE各版本的css hack

一:IE各版本的css hack

 

HACKEXAMPLEIE6(S)IE6(Q)IE7(S)IE7(Q)IE8(S)IE8(Q)
**colorYesYesYesYesNoYes
++colorYesYesYesYesNoYes
--colorYesYesNoNoNoNo
__colorYesYesNoYesNoYes
##colorYesYesYesYesNoYes
\0color\0NoNoNoNoYesNo
\9color\9YesYesYesYesYesYes
!important

color:blue!important;

color:green;

NoNoYesNoYesNo

 

这里S代表standard标准模式,Q代表Quirks怪异模式

 

div {	
    background: gray; /* 基本的 */
    background: pink\9; /* IE 8 及低于IE8版本 */
    *background: green; /* IE 7 及低于IE7版本 */
    _background: blue; /* IE 6 */
}

 

 

二:根据条件注释设置不同的class

 

<!--[if lt IE 7 ]> <div class="ie6"></div> <![endif]-->
<!--[if IE 7 ]> <div class="ie7"></div> <![endif]-->
<!--[if IE 8 ]> <div class="ie8"></div> <![endif]-->
<!--[if IE 9 ]> <div class="ie9"></div> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <div></div> <!--<![endif]-->

 

更详细的解释:

 

<!--[if lt IE 7]>版本小于IE7将看到这行<![endif]-->
<!--[if lte IE 7]>版本小于或等于IE7将看到这行<![endif]-->
<!--[if IE 7]>版本如果是IE7将看到这行<![endif]-->
<!--[if gt IE 7]>版本大于IE7将看到这行<![endif]-->
<!--[if gte IE 7]>版本大于或等于IE7将看到这行<![endif]-->
 

 

三: 相关博客:

 

用条件注释为IE隔离CSS

FF、IE7、IE6的CSS问题

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值