针对firefox ie6 ie7 ie8的css样式hack
针对firefox ie6 ie7 ie8的css样式hack
发布时间:2016-12-27 来源:查字典编辑
摘要:针对firefoxie6ie7ie8的css样式hack以前我们大部分都是用!important来hack,对于ie6和firefox测试可...

针对firefox ie6 ie7 ie8的css样式hack

以前我们大部分都是用!important来hack,对于ie6和firefox测试可以正常显示,但是ie7以上对!important可以正确解释,会导致页面没按要求显示!搜索了一下,找到了一个针对IE7、IE8不错的hack方式,IE7使用*+html或*line-height: 23px,IE8使用“9”来区分,比如:line-height: 26px9。

CSS可以参照如下定义,注意顺序:

#menu { line-height: 23px; }/* firefox 浏览器实行这句定义 */

#menu { line-height: 26px9; }/*ie6,ie7,ie8 这句定义主要尖对IE8来hack*/

#menu { *line-height: 23px; }/*ie6,ie7 这句定义主要尖对IE7来hack*/

#menu { _line-height: 23px; }/*ie6 浏览器优先实行这句定义*/ 或者写成一句

#menu { line-height:23px; line-height: 26px9; *line-height: 23px; _line-height:23px; } 或者

* html #menu { line-height: 23px; } /* IE6 浏览器实行这句定义 */

*+html #menu { line-height: 23px; }/* IE7 浏览器实行这句定义*/

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新 Div+Css教程学习
热门 Div+Css教程学习
网页设计子分类