您的位置:首页 > Web前端 > CSS

CSS区分IE6,IE7,IE8,firefox 的方法汇总

2010-12-14 13:19 351 查看
区别IE6、7与FF/IE8:
background:blue;*background:orange;

引用
显示效果:
IE 6/7:orange
FF/IE8:blue
原理:FF/IE8不支持*开头,而IE6/7都支持。

区别IE6与IE7/IE8/FF:
background:green;_background:blue;

引用
显示效果:
IE7/8/FF:green
IE6:blue
原理:IE6支持下划线"_",IE7、8和firefox均不支持下划线。

区别FF/IE8和IE6/7:
background:orange;+background:green;-background:blue;
或者
background:orange;*background:green!important;*background:blue;

引用
显示效果:
IE6:blue
IE7:green
FF/IE8:orange
原理:IE6能识别-,IE7能识别+,IE8和FF都不能识别+和-
IE8/FF都不识别*,IE7优先识别!important,IE6不能识别!important。

关于IE8的hacks:
.test{
color:/*/**/#00f/9; /* IE8 only */
color:#00f/9; /* 适用于所有IE版本 */
}

可同时区分IE8、IE7、IE6、Firefox的CSS hacks:
.test{
color:#000; /* Firefox */
color:/*/**/#00f/9; /* IE8 */
*color:#f00; /* IE7 */
_color:#0f0; /* IE6 */
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: