【问题标题】:IE Specefic css not called by internet explorerInternet Explorer 未调用 IE 特定 css
【发布时间】:2014-05-26 13:27:21
【问题描述】:

我正在尝试制作一个在 IE 浏览器上表现不同的网站。我通过为 IE 浏览器调用不同的 css 并为不同的浏览器调用另一个 css 来做到这一点。但是在 IE 浏览器上没有调用 IE SPECIFIC css

 <html>
    <!--[if IE 8]><link rel="stylesheet" type="text/css" href="ie.css" if="IE 8"/><![endif]-->

    <head>
        <link href="new.css" rel="stylesheet"/>
    </head>

    <body id="bdy">
        <div id="wrapper">
            <div id="header">
                <div id="logo">
    <div id="log_in">
                   </div>
                </div>
            </div>
            <div id="menu">

            </div>
            <div id="main">
                <div id="left_div">
                   </div>
                <div id="right_div">
                    <div id="table_items"></div>
                    <div id="addv"></div>
                </div>
            </div>
            <div id="footer"></div>
        </div>
    </body>
    </html>

【问题讨论】:

    标签: html css internet-explorer internet-explorer-8


    【解决方案1】:

    如果你只针对IE8 version,那么你必须使用这个条件语句。

    <!--[if IE 8]>
        <link rel="stylesheet" type="text/css" href="ie8.css" />
    <![endif]-->
    

    【讨论】:

      【解决方案2】:

      如果您不想创建单独的 css 文件,请遵循以下语法。

      <!--[if IE 8 ]> <html class="ie8"> <![endif]-->
      

      例如,您有一个名为 borderright 的类,并且您想为 ie8 应用不同的样式,然后添加您的类,如下所示。

      .ie8 .borderright
      {
        /*Your Style goes here*/
      }
      

      【讨论】:

        【解决方案3】:

        你的代码:

        <!--[if IE 8]><link rel="stylesheet" type="text/css" href="ie.css" if="IE 8"/><![endif]-->
        

        放在head标签之前。

        将该代码放入head 标签内!并删除if="IE 8" 部分

        【讨论】:

          猜你喜欢
          • 2011-01-28
          • 2012-04-11
          • 1970-01-01
          • 1970-01-01
          • 2015-03-05
          • 2012-12-05
          • 2018-05-05
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多