【问题标题】:How to combine these 2 IE conditional statements into one?如何将这 2 个 IE 条件语句合二为一?
【发布时间】:2012-09-03 04:48:40
【问题描述】:

对于移动优先响应式网站。我正在结合HTML5 Boiler plateMobile Boilerplate

我有一个小问题。

如何将这2个IE条件语句合二为一?

<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<!--[if (gt IEMobile 7)|!(IEMobile)]><!--> <html class="no-js"> <!--<![endif]-->

【问题讨论】:

    标签: html internet-explorer mobile html5boilerplate


    【解决方案1】:

    你试过这个吗:

    <!--[if (gt IE 8)|((gt IEMobile 7)|!(IEMobile))]><!-->
    <html class="no-js">
    <!--<![endif]-->
    

    据我所知,应该可以添加另一对括号并将它们与or 运算符组合。

    顺便说一句,我认为以这种方式操作 html 标记不是一个好主意。

    【讨论】:

      【解决方案2】:

      详情请参阅http://en.wikipedia.org/wiki/Conditional_comment

      您可以将逻辑表达式与 ands 和 ors 组合(分别为&amp;|)。

      那就试试吧:

      <!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)]><!--> <html class="no-js"> <!--<![endif]-->
      

      【讨论】:

      • 我喜欢有人打我一拳,而我会给出错误的答案。我确信这是不可能的。
      【解决方案3】:
      <!--[if gt IE 8 |((gt IEMobile 7)|!(IEMobile))]><!--> <html class="no-js"> <!--<![endif]-->
      

      来源: http://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-12-03
        • 1970-01-01
        • 1970-01-01
        • 2021-03-09
        • 2010-10-07
        • 1970-01-01
        • 2021-03-15
        相关资源
        最近更新 更多