您如何使用条件注释来定位


仅Internet Explorer
某些IE版本
某些IE版本和所有其他浏览器
没有IE,只有其他浏览器


以验证的方式? (validator.w3.org/

最佳答案

我测试了这些,它们是有效的HTML。

重要提示:Only IE 5 through 9 support conditional comments.

<!-- 1. IE 5-9 only: -->

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


<!-- 2. Some IE versions -->

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


<!-- 3. Some IE versions, plus all non-IE browsers -->

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


<!-- 4. All browsers except IE 5-9 -->

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

关于html - 针对非IE浏览器和特定IE版本的有效条件注释,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33132856/

10-12 12:38
查看更多