CSS Hack法:写在样式表文件或HTML文档中,运用浏览器的HACK来达到解析不同样式表的目的~注意书写的顺序.
.selector{
color:#ff0000; /* 所有浏览器 */
color:#ff66009; /* 所有IE浏览器 */
+color:#0044dd; /* IE7 */
_color:#000; /* IE6 */
}
看看演示:
提示:你可以先修改部分代码再运行。
IE注释法:写在HTML文档中,只适用于IE浏览器,可以让各版本的IE解析不同的HTML.
语法:
<!–[if lt IE 7]>
code here
<![endif]–>
可以做一些高级点的判断:
- gt = selects greater than(高于)
- lt = selects less than(低于)
- gte = selects greater than or equal to(>=)
- lte = selects less than or equal to(<=)
- ! = selects everything except what directly follows the “!”(选择所有,除了!)
看看演示:
提示:你可以先修改部分代码再运行。
