How to target Microsoft Edge with CSS? [duplicate]

2019-01-13 10:18发布

问题:

This question already has an answer here:

  • How to Identify Microsoft Edge browser via CSS? 4 answers

I would like to target Edge and have flexbox behave simliar to Firefox 33 / Chrome, for more detail see this question.

Can one target Edge in CSS?

回答1:

To target Edge, we can check for -ms-ime-align support, Edge being the only Microsoft browser that supports this property:

@supports (-ms-ime-align: auto) {
  .selector {
        color: red;
  }
}

Or this one-liner (that one works on Edge and all IEs also):

_:-ms-lang(x), .selector { color: red; }

Further explanation, including variants to support specific versions of Edge, can be found in this article.