在IE中查看时,它正确地显示我是IE
在Chrome / Firefox中查看时,它错误地显示我是IE,我不是IE而不是我不是IE。 =jsfiddle/Hgx97/ =noreferrer> jsfiddle/Hgx97/
解决方案您在第一行中错误地终止了IE条件注释,所以其他浏览器将会看到分隔符之间的内容(您还可以看到第一行的文本如何突出显示为黑色,不是你想要的):
<! - [if(IE)]>我是IE<![endif] - > <! - [if!(IE)]><! - >我不是,即<! - <![endif] - >第二行是正确的,因为您想将内容展示给非IE浏览器。
更新小提琴
I have the following in my html document.
<!--[if (IE)]><!--> i am IE <!--<![endif]--> <!--[if !(IE)]><!--> i am not ie <!--<![endif]-->When viewed in IE it properly says "i am IE"
When viewed in Chrome/Firefox it incorrectly says "i am IE i am not ie" instead of "i am not IE"
jsfiddle/Hgx97/
解决方案You're incorrectly terminating the IE conditional comments on the first line, so other browsers will see the content between the delimiters (you can also see how the text is highlighted black on the first line, which is not what you want):
<!--[if (IE)]> i am IE <![endif]--> <!--[if !(IE)]><!--> i am not ie <!--<![endif]-->The second line is correct since you want to show that content to non-IE browsers.
Updated fiddle
更多推荐
HTML IE条件语句:不适用于Chrome / Firefox
发布评论