Shu*_*ubh 7 html css stylesheet conditional-comments internet-explorer-11
我想css只为IE11浏览器加载一个文件.我该怎么做?
我知道我可以使用conditional comments加载样式表的IE <= 9.但不适用于IE 10和11.
我可以谷歌找到一个替代方案如下:
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
}
Run Code Online (Sandbox Code Playgroud)
但是,它加载IE10和IE11浏览器.我想只为IE11 加载样式表.可能吗?
谢谢
小智 17
如果它只是IE11
@media all and (-ms-high-contrast:none)
{
.foo { color: green } /* IE10 */
*::-ms-backdrop, .foo { color: red } /* IE11 */
}
Run Code Online (Sandbox Code Playgroud)
如果你的目标是IE 9,10,11,你可以试试
@media screen and (min-width:0\0) {
/* Enter CSS here */
}
Run Code Online (Sandbox Code Playgroud)
如果是IE10 +的话
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
/* IE10+ specific styles go here */
}
Run Code Online (Sandbox Code Playgroud)
此外,谷歌搜索提出了这个问题
_:-ms-fullscreen, :root .ie11up { property:value; }
Run Code Online (Sandbox Code Playgroud)