【发布时间】:2015-01-15 16:57:09
【问题描述】:
我可以拥有特定于 IE 的 CSS 吗?
在这种情况下,我不能包含另一个脚本。
所以我不能这样做:
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie-only.css" />
<![endif]-->
这不起作用:
<!--[if IE]>
<style>
@media only screen and (min-width: 943px) and (orientation:portrait){
.ele{
width:100px;
}
}
</style>
<![endif]-->
还有其他方法可以添加特定于 IE 的 CSS 吗?
【问题讨论】:
-
“不起作用”以什么方式?
-
@JamesDonnelly 因为样式没有生效
-
您可以执行类似
<!--[if IE]><body class="ie"><![endif]-->之类的操作,如果不是 ie,则可以使用备用方法,然后只需设置您的 ie 元素样式:.ie .etc {}See this for more info -
对于 IE 10+ 样式,你可以使用这个@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { /* IE10+ CSS styles go这里 */ }
-
在哪个版本的 ie 中这不起作用?如果低于 ie9 他们不支持媒体查询。
标签: css internet-explorer media-queries stylesheet