2009年3月13日星期五

Internet Explorer CSS hacks

测试环境:IE6 , IE7, IE8, FF3.0
表达方式:

body { `background:red }
body { ~background:red }
body { !background:red }
body { @background:red }
body { #background:red }
body { $background:red }
body { %background:red }
body { ^background:red }
body { &background:red }
body { *background:red }
body { (background:red }
body { )background:red }
body { =background:red }
body { +background:red }
body { [background:red }
body { ]background:red }
body { {background:red }
body { |background:red }
body { ,background:red }
body { <background:red }
body { .background:red }
body { >background:red }
body { /background:red }
body { ?background:red }

结论:IE识别所有CSS Hack

比如我们要实现在 IE 中 480px 的宽度,而在其他浏览器 500px 的宽度,就可以通过 Hack 来完成,如下:
#hack {
width
:500px;
+width:480px; /*only IE*/
}

没有评论: