谁说IE6不支持!important
许多人认为ie6不支持!important,其实是被一条针对ie 6的css hack给误导了。
这条css hack是:
.test {
height: auto !important;
height: 500px;
}
.test的高度在其他浏览器里面是auto,而在ie6里面是500px,许多人在解释这条css hack之所以会生效是因为ie6不支持!important,误导了不少人。
其实ie6本身是支持!important的,下面换一种写法:
.test {
height: auto !important;
}
.test {
height: 500px;
}
发现ie6里面.test的高度也是auto,这说明ie6是支持!important的。那上面的hack之所以会生效是因为ie6的一个小小的bug,即当你把两条相同的声明放到同一个选择器里面的时候ie6才不认识!important。然而大部分时候,这个小小的bug并不影响我们在ie6内使用!important。
IE6的呈现真是让人弄不明白。。。
George Wing
27 Feb 10 at 1:05 pm
I’m impressed! It’s too bad more folks haven’t heard about this place, it covered what I needed to know!
online surveys cash
16 Jun 10 at 9:11 pm