css hack 收藏
FireFox | IE7/8 | IE6 | ||
在css文件中导入另一个css文件(屏幕) 例:@import url("xxx.css") screen; |
y | n | n | FF特有 |
选择符[class=xxx]{...} 例:p[class=...]{color:#ffff00;} |
y | y | n | |
[xmlns] 选择符{...} 例:[xmlns] p{color:#f0f;} |
y | y | n | |
*属性(或+属性)(星号或加号) 例:p{*color:#f00;} |
n | y | y | (1). |
_属性 (下划线) 例:p{_color:#f00;} |
n | n | y | (2). IE6特有 |
属性:值 !important (重要的) 例:p{color:#ff0 !important;} |
y | y | x | (3). |
CSS属性设置顺序:FireFox -> IE7 -> IE6
(即标准的浏览器[FF]写在前面,不标准的浏览器[IE6]写在后面覆盖前面的)。
示例:
区别IE6与FF: background:orange;*background:blue;
区别IE6与IE7:background:orange!important;background:blue;
区别IE7与FF: background:orange;*background:blue;
区别FF,IE7,IE6:
background:orange;*background:green !important;*background:blue;
background:orange;*background:green;_background:blue;(IE6的属性被赋值3次)