19

I found a way to apply media queries to IE using:

@media (-ms-high-contrast: none), (-ms-high-contrast: active) {

}

Is there a way do the same to apply CSS to all browsers but IE? Something like:

@media not( (-ms-high-contrast: none), (-ms-high-contrast: active) ) {

}

I'd like to avoid using the HTML tags.

1 Answer 1

29

Use a @supports query for browsers that are not Internet Explorer. @supports queries are compatible with all browsers except Internet Explorer.

@supports not (-ms-high-contrast: none) {
   /* Non-IE styles here */
}

Example on Codepen

2
  • ok now im confused. i thought that code will run css if browser is Edge, since it says there "Non-IE". But i tried that in the edge browser and it does not work. Chrome and Firefox works.
    – chitgoks
    Aug 31, 2019 at 23:51
  • I must have misunderstood your comment. Did you try the Codepen example? I tried it in Edge 44/EdgeHTML 18 on Windows 10 and this is what it looks like: imgur.com/a/0vYnhWm Sep 6, 2019 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.