【问题标题】:Conditional stylesheets. I need to style according IE versions and having条件样式表。我需要根据 IE 版本设置样式并拥有
【发布时间】:2013-04-08 12:35:38
【问题描述】:

您好,
我写了一个条件样式表,但找不到 IE7-IE7.9

的条件

我写了这些:

• 等于 IE6 或小于 IE6 .. => [如果 lte IE 6]

• IE7-IE7.9 .. => [??]

• 等于 IE8 且大于 IE8(表示 IE8-IE8.9、IE9、IE10..).. => [if gte IE 8]

所以,我找不到 IE7-IE7.9 的条件
我需要检测 IE7,它是 7.9 之前的更高版本。

你对这类问题的解决方案是什么?

我最后的代码是这样的:

<link rel="stylesheet" href="template_style.css" type="text/css" />
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="ie6-and-down.css" />
<![endif]-->
<!--[??]>
<link rel="stylesheet" type="text/css" href="ie7-and-up-till-ie7.9.css" />
<![endif]-->
<!--[if gte IE 8]>
<link rel="stylesheet" type="text/css" href="ie8-and-up.css" />
<![endif]-->

【问题讨论】:

    标签: internet-explorer internet-explorer-7 conditional stylesheet detect


    【解决方案1】:

    另一种方法是使用类来处理条件 IE 样式-:

    <!--[if lt IE 7]>  <html class="ie ie6 lte9 lte8 lte7"> <![endif]-->
    <!--[if IE 7]>     <html class="ie ie7 lte9 lte8 lte7"> <![endif]-->
    <!--[if IE 8]>     <html class="ie ie8 lte9 lte8"> <![endif]-->
    <!--[if IE 9]>     <html class="ie ie9 lte9"> <![endif]-->
    <!--[if gt IE 9]>  <html> <![endif]-->
    

    在上面的示例中,如果使用 IE7,则会设置类 ie7 lte8

    【讨论】:

    • 但我的 html 元素已经填充了 Modernizr 的“no-js”类...&lt;html class="no-js"&gt;
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-04
    相关资源
    最近更新 更多