ie7发布已经有些日子了,因此网站需要照顾的浏览器又多了一个。这两天设计师们在做兼容,找到了一个解决办法,这里既是共享,也是记录。结合之前自己使用important!和/**/来区分ie5、ie6、moz的经历,以下代码区分4个浏览器,复制代码保存成一个html文件看看效果吧:(
无标题文档 ie5: yellow ie6: green ie7: blue moz: red
[ctrl+a 全选 注:如需引入外部js需刷新才能执行]
特别提醒:
#example {
background: red; /*for moz*/
}
* html #example {
background: yellow; /*for ie5*/
background/**/: green; /*for ie6*/
}
*+html #example {
background: blue; /*for ie7*/
}