【问题标题】:Conditional Comment not working条件注释不起作用
【发布时间】:2014-10-08 04:14:40
【问题描述】:

我将此代码放入我的<head>,以便为 IE8 加载额外的样式表。

<!--[if lt IE 9]>

   <link rel="stylesheet" href="style-ie.css">

<![endif]-->

我也已经这样做了 1000 次,但是这一次它不起作用。它只是没有加载到 IE8 中。如果我删除条件注释,它会正常加载。

有人有想法吗?

【问题讨论】:

    标签: internet-explorer-8 conditional conditional-comments


    【解决方案1】:

    也许,由于您的目标是 IE8,您应该保留在 HTML5 中不再需要的 type="text/css" 位?即:

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

    这是针对 HTML5 网站还是 XHTML / HTML4?如果是针对 HTML5 站点,我通常会针对这些情况执行以下操作,因为在相同的条件注释中添加 HTML5 shim 位也是一个好主意:

    <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <link href="css/ie.css" rel="stylesheet" type="text/css" />
    <![endif]-->
    

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 2014-04-02
      • 2012-05-07
      • 2012-01-25
      • 2017-01-21
      • 1970-01-01
      • 2012-02-16
      • 2013-01-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多