IE条件语句选错页样式

时间:2011-06-23 18:22:24

标签: internet-explorer internet-explorer-6

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

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]-->

1 个答案:

答案 0 :(得分:2)

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

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

<!--[if !IE 6]><!--> DEFAULT STYLE SHEET <!--<![endif]-->
<!--[if IE 6]> IE STYLE SHEET <![endif]-->
相关问题