如何使用 CSS 定位 Microsoft Edge?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32940965/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to target Microsoft Edge with CSS?
提问by maxhungry
I would like to target Edge and have flexbox behave simliar to Firefox 33 / Chrome, for more detail see this question.
我想定位 Edge 并使 flexbox 的行为类似于 Firefox 33/Chrome,有关更多详细信息,请参阅此问题。
Can one target Edge in CSS?
一个可以在 CSS 中定位 Edge 吗?
回答by Raptor
To target Edge, we can check for -ms-ime-align
support, Edge being the only Microsoft browser that supports this property:
要定位 Edge,我们可以检查是否-ms-ime-align
支持,Edge 是唯一支持此属性的 Microsoft 浏览器:
@supports (-ms-ime-align: auto) {
.selector {
color: red;
}
}
Or this one-liner (that one works on Edge and all IEs also):
或者这个单行(那个也适用于 Edge 和所有 IE):
_:-ms-lang(x), .selector { color: red; }
Further explanation, including variants to support specific versions of Edge, can be found in this article.
进一步的解释,包括支持特定版本 Edge 的变体,可以在这篇文章中找到。