【问题标题】:Ignoring css in ie [duplicate]忽略ie中的css [重复]
【发布时间】:2014-09-25 12:43:40
【问题描述】:

有一种方法可以通过这个语句忽略ie中的文件/css

<!--[if IE]>
        <script src="js/ie_html5.js"></script>
    <![endif]-->

有没有其他方法可以忽略ie中的css

我只想为 ie 创建完全不同的 css,但其他 css 没有正确呈现页面,我想忽略它们。

【问题讨论】:

  • 不确定您的意思,但您也可以使用&lt;!--[if !IE]--&gt; 等。查看this link 了解更多示例

标签: css internet-explorer


【解决方案1】:

正如我从这个问题中得到的,这个问题在以下链接中讨论过

Apply CSS rules if browser is IE

【讨论】:

    【解决方案2】:
    window.onload = function() {
    var script='<!--[if IE]>'+'<script src="js/ie_html5.js"></script>'+'<![endif]-->';
    var test = document.createElement('script');
    test.type = 'text/javascript';
    test.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'www.example.com/test.js';
    
    var isIE = /*@cc_on!@*/false || !!document.documentMode;
    if(isIE){
            console.log(test);
            document.getElementsByTagName('head')[0].appendChild(test);
    }
    else{
    }
    
    };
    

    <!--[if IE]>
       You're using IE!
    <![endif]-->
    <![if !IE]>
       You're using something else!
    <![endif]>
    

    您可以找到有关条件 cmets here 的文档。

    【讨论】:

      猜你喜欢
      • 2014-10-16
      • 2012-09-14
      • 2014-02-10
      • 2013-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-26
      • 2011-04-11
      相关资源
      最近更新 更多