简体   繁体   English

IE条件注释

[英]IE conditional comments

Why this line doesn't work? 为什么这条线不起作用?

<!--[if !IE]>--><link rel="Stylesheet" runat="server" href="Styles/IE.css" /><!--<![endif]-->

Is it something not supported in newer version of IE? 较新版本的IE不支持该功能吗?

Please assist, thanks. 请协助,谢谢。

<!--[if IE]> <![endif]-->

http://www.quirksmode.org/css/condcom.html http://www.quirksmode.org/css/condcom.html

you have your opening and closing wrong. 您打开和关闭错误。 sorry for brief answer, I'm on my mobile phone. 抱歉,我只是在用手机。

Support for conditional comments has been removed in Internet Explorer 10 standards and quirks modes for improved interoperability and compliance with HTML5. Internet Explorer 10标准和怪异模式中已删除了对条件注释的支持,以提高互操作性和与HTML5的兼容性。 This means that Conditional Comments are now treated as regular comments, just like in other browsers. 这意味着条件注释现在像其他浏览器一样被视为常规注释。

http://msdn.microsoft.com/en-us/library/ie/hh801214%28v=vs.85%29.aspx http://msdn.microsoft.com/zh-CN/library/ie/hh801214%28v=vs.85%29.aspx

The easy fix is to add an special META tag to tell to IE to emulate IE9 最简单的解决方法是添加一个特殊的META标签以告知IE模拟IE9

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">

This is a quick fix but the long-term solution is to remove the dependency from the code. 这是一个快速解决方案,但是长期的解决方案是从代码中删除依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM