IE 9中的条件注释。注释和条件语句之间的空间 [英] Conditional comment in IE 9. Space between comment and conditional statement
问题描述
我正在使用以下IE条件语句来加载特定于IE的样式表。该语句在IE 7、8和9兼容性视图中有效。但是,当我在纯IE 9中查看该页面时,该页面为空。我在开发人员工具中对其进行了检查,似乎条件语句从未关闭过,有效地注释了页面的其余部分。
I'm using the following IE conditional statement to load an IE-specific stylesheet. The statement works in IE 7, 8 and 9 Compatibility View. However, when I viewed the page in plain IE 9, the page was empty. I inspected it in developer tools, and it appears as though the conditional statement never closes, effectively commenting out the rest of the page.
<!--[if lt IE 9]><link xmlns="" rel="stylesheet" href="http://colum.edu/Site_Files/localist/css/ie.css" /><[endif]-->
经过大量的拔发之后,我终于弄清楚了,如果我在括号作为条件注释的注释,它在IE 9中有效:
After a decent amount of hair-pulling, I finally figured out that if I add a space before the brackets for the conditional comment, it comment works in IE 9:
<!-- [if lt IE 9]><link xmlns="" rel="stylesheet" href="http://colum.edu/Site_Files/localist/css/ie.css" /><[endif]-->
唯一的区别是注释和条件语句之间有空格...
The only difference is that there is a space between comment and the conditional statement...
<!--[if lt IE 9]> vs <!-- [if lt IE 9]>
我不知道为什么这会发生。同样,只有浏览器模式:IE9而不是文档模式:IE9标准的浏览器模式:IE9兼容性视图才会发生。 (我意识到最简单的解决方案是增加空间。但是,实际页面位于托管服务上,并且我只能编辑自己的东西。)无论如何,这里有一些示例:
I can't figure out why on earth this is happening. Again, it only happens is "Browser Mode: IE9" not "Browser Mode: IE9 Compatibility view" with "Document Mode: IE9 standards". (I realize that the simplest solution is to add the space. However the real page lives on a hosted service, and I'm limited in what I can edit.) Anyways, here are some examples:
不起作用: http://dev.ashramcreative.com/ccc /localist/ie9.html
工作: http://dev.ashramcreative.com/ccc/localist/ie9-space.html
推荐答案
我遇到了同样的事情;并在浏览器模式下在条件固定IE9之前添加空格。
I just ran into the same thing; and adding the space before the conditional fixed IE9 in browser mode.
阅读这篇文章我能够确定应归咎于meta标签。
After reading this post I was able to determine that a meta tag was to blame.
在我纠正了meta标签之后(在我的情况下,meta http-equiv =内容类型
),则在浏览器模式下IE9可以正常工作而没有空格。
After I corrected the meta tag (in my case meta http-equiv=content-type
), IE9 in browser mode worked correctly without the space.
但是,在您的情况下,它看起来好像< [endif]->
应该是<![endif]->
However, in your case it appears as though the <[endif]-->
should be <![endif]-->
这篇关于IE 9中的条件注释。注释和条件语句之间的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!