2011-06-23 24 views
0

我在头部使用条件语句来使用基于ie浏览器版本的样式表。我的印象是,如果你在条件if语句中指定了一个样式表,它应该只使用那个。我有一个ie6的样式表和一个覆盖7/8 ff等ie6似乎是使用两者的混合物。它是否正确?感谢IE条件语句挑选错误样式表

主要样式表7/8 FF等

<link href="css/style.css" rel="stylesheet" type="text/css" /> 

,并根据browswer IE6的样式表的调用。

<!--[if IE 6]> 
    <link href="css/ie6-style.css" rel="stylesheet" type="text/css" media="screen, projection"> 
    <link href="css/ie6-dropdown-menu.css" rel="stylesheet" type="text/css" media="screen, projection"> 
    <![endif]--> 

回答

2

条件注释中链接的样式表不会替换其他样式表。两者都将被加载。以这种方式工作通常更容易,IE6版本只包含覆盖。

如果您希望IE6忽略其他文件,请使用否定条件。

<!--[if !IE 6]><!--> DEFAULT STYLE SHEET <!--<![endif]--> 
<!--[if IE 6]> IE STYLE SHEET <![endif]--> 
+0

谢谢。非常感激 – bollo