条件评论无法按预期工作

时间:2013-04-22 10:18:40

标签: html internet-explorer conditional-comments

我正在开发一个网站,我已经看到内容在IE上无法正确显示,所以我想用其他与IE兼容的内容替换它们。

这就是我正在使用的:

<!--[if !IE]> -->
    <div id="container">
        This is not IE, you are seeing the normal content
    </div>
<!-- <![endif]-->

<!--[if IE]>
    <div id="container">
        This is IE, you are seeing IE-compatible content
    </div>
<![endif]-->

问题在于IE版本&lt; 10,甚至兼容模式为ON的版本10我看到了

This is IE, you are seeing IE-compatible content

但是在兼容模式为OFF的IE 10中,我看到了

This is not IE, you are seeing the normal content

为什么?

对于想要尝试的人:JSFiddle

2 个答案:

答案 0 :(得分:0)

IE10中没有条件评论

答案 1 :(得分:0)

Internet Explorer 10 removed support for conditional comments,因此它们现在被视为常规评论。