Home > NoteTidy, Web-Design > 兼容区分Firefox,IE7,IE6的CSS Hack Code

兼容区分Firefox,IE7,IE6的CSS Hack Code

October 22nd, 2008

兼容区分 IE6, IE7, Firefox 浏览器下的 CSS Hack 写法.

区别 IE6FF:
background:orange;*background:blue;

区别 IE6 IE7:
background:green !important;background:blue;

区别 IE7 与 FF:
background:orange; *background:green;

区别 FF, IE7, IE6:
background:orange;*background:green !important;*background:blue;

注:IE都能识别*;标准浏览器(如FF)不能识别*;
IE6能识别*,但不能识别 !important,
IE7能识别*,也能识别!important;
FF不能识别*,但能识别!important;

另外补充一个, 下划线”_”,
IE6支持下划线,IE7和firefox均不支持下划线。

通常可以这样来区分 IE6, IE7, Firefox,

background:orange; *background:green;_background:blue;

注:不管是什么方法, 书写的顺序都是 Firefox 的写在前面, IE7 的写在中间, IE6的写在最后面。

NoteTidy, Web-Design , , ,

  1. May 7th, 2009 at 16:20 | #1

    不错,帮了个大忙,终于把问题解决掉了

  1. No trackbacks yet.