.example{
color:#fff;//FF,OP,IE8
*color:#ff0;//IE7
_color:#f00;//IE6
}
但如果想要对IE8单独定义样式,可以这样:
html*~body .example{这里是针对IE8识别的样式}
针对IE9的CSS只需在相应CSS代码加入只有IE9识别的 \9\0。具体代码如下:
.div{ background-color:#0f0\9\0;/* ie9 */ }
其他浏览器写法:
background-color:#f00;/*all*/
background-color:#0ff\0;/* ie 8/9 */
background-color:#0f0\9\0;/* ie9 */
*background-color:#00f;/*ie7*/
_background-color:#ff0;/*ie6*/
background-color//:#090;/*非IE*/
background-color:#900\9;/*所有ie*/
}
怎么规定CSS的属性仅在IE下生效?在非IE浏览器下不生效
<!--[if IE]>
<style>
.test{color:red;}
</style>
<![endif]-->
css中判断IE版本的语句<!--[if gte IE 6]> Only IE 6/+ <![endif]-->:
1. <!--[if !IE]> 除IE外都可识别 <!--<![endif]-->
2. <!--[if IE]> 所有的IE可识别 <![endif]-->
3. <!--[if IE 5.0]> 只有IE5.0可以识别 <![endif]-->
4. <!--[if IE 5]> 仅IE5.0与IE5.5可以识别 <![endif]-->
5. <!--[if gt IE 5.0]> IE5.0以及IE5.0以上版本都可以识别 <![endif]-->
6. <!--[if IE 6]> 仅IE6可识别 <![endif]-->
7. <!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]-->
8. <!--[if gte IE 6]> IE6以及IE6以上版本可识别 <![endif]-->
9. <!--[if IE 7]> 仅IE7可识别 <![endif]-->
10. <!--[if lt IE 7]> IE7以及IE7以下版本可识别 <![endif]-->
11. <!--[if gte IE 7]> IE7以及IE7以上版本可识别 <![endif]-->

417

被折叠的 条评论
为什么被折叠?



