CSS兼容IE6,IE7,FIREFOX的hack收集
一种,是CSS HACK的方法注意顺序。
程序代码 程序代码
height:20px; /*For Firefox*/
*height:25px; /*For IE7 & IE6*/
_height:20px; /*For IE6*/
下面是针对id或者是自定义的样式也属于CSS HACK,不过没有上面这样简洁。
程序代码 程序代码
#example { color: #333; } /* Moz */
* html #example { color: #666; } /* IE6 */
*+html #example { color: #999; } /* IE7 */
第二种是使用IE专用的条件注释,也就是在引用或者导入css的时候使用“注释判断”来兼容。
程序代码 程序代码
<!--其他浏览器 -->
<link rel="stylesheet" type="text/css" href="css.css" />
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="ie7.css" />
<![endif]-->
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="ie.css" />
<![endif]-->
CSS兼容IE6,IE7,FIREFOX的hack收集
本文介绍了CSS Hack的两种常见方法:一是通过特定语法实现不同浏览器的样式差异化处理;二是利用IE条件注释来针对性地加载不同的样式表,确保网站在IE6、IE7及Firefox等浏览器中的一致性和兼容性。

被折叠的 条评论
为什么被折叠?



