IE7能识别*,也能识别!important;
FF不能识别*,但能识别!important;
另外再补充一个,下划线”_“,
IE6支持下划线,IE7和firefox均不支持下划线。
于是大家还可以这样来区分firefox,IE7,IE6
background:green!important; *background:orange; _background:blue;
注:不管是什么方法,书写的顺序都是firefox的写在前面,IE7的写在中间,IE6的写在最后面。
2.在firefox和IE中的BOX模型解释不一致导致相差2px解决方法
div{margin:30px!important;margin:28px;}
注意这两个margin的顺序一定不能写反,!important这个属性IE不能识别,但别的浏览器可以识别。所以在IE下其实解释成这样:div{maring:30px;margin:28px}重复定义的话按照最后一个来执行,所以不可以只写margin:XXpx!important;
3.条件性注释来选择不同的浏览器(比CSS hack简洁)
<!–[if IE 6]>
<link rel=”stylesheet” type=”text/css” href=”ie6.css” mce_href=”ie6.css”>
<![endif]–>
4.区分IE8
.color{
background-color: #CC00FF; /*所有浏览器都会显示为紫色*/
background-color: #FF00009; /*IE6、IE7、IE8会显示红色*/
*background-color: #0066FF; /*IE6、IE7会变为蓝色*/
_background-color: #009933; /*IE6会变为绿色*/
二十五、 W3C遵循的标准原则










