html - 为什么 IE 特定样式表被忽略

标签 html css internet-explorer

我在网站的 HEAD 部分中有以下样式表:

<!--[if !IE]-->
<link rel="stylesheet" href="theStyles/defaultStyle.css" type="text/css" charset="utf-8" />
<!--[endif]-->
<!--[if IE]>
<link rel="stylesheet" href="theStyles/defaultStyle_ie.css" type="text/css" charset="utf-8" />
<![endif]-->

我正在运行 IE 版本 10,但出于某种原因它正在读取非 IE 样式表。知道如何解决吗?我必须具体说明 IE 条件吗?

我看开发者工具,只加载了NON IE版本...

最终使用了这个:

<script type="text/javascript">
if (window.clipboardData)
     alert("You are using IE!");
else
     alert("NON IE");
</script>

最佳答案

根据 Microsoft :

As of Internet Explorer 10, conditional comments are no longer supported by standards mode. Use feature detection to provide effective fallback strategies for website features that aren't supported by the browser.

and

Support for conditional comments has been removed in Internet Explorer 10 standards and quirks modes for improved interoperability and compliance with HTML5. This means that Conditional Comments are now treated as regular comments, just like in other browsers. This change can impact pages written exclusively for Windows Internet Explorer or pages that use browser sniffing to alter their behavior in Internet Explorer.

关于html - 为什么 IE 特定样式表被忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21681685/

相关文章:

javascript - 即使在casperjs中assertExist为true也找不到元素

javascript - HTML5 移动网络应用程序的音频延迟

html - 在显示中垂直居中文本 :table-cell div that also has vertical-align:top content

html - 将文本与 HTML 中的图像对齐到行的底部

html - 元素宽度的 IE 可计算性问题

html - 是否可以继承css类?

html - ie7 子 block 元素扩展并忽略父填充

html - ie9 问题和编译的 LESS CSS

css - IE浏览器滚动条的宽度?

internet-explorer - Google Maps Places AutoComplete 不能在 Windows Phone 上运行?