Apply CSS to all browsers except IE using media qu

2020-06-08 08:15发布

问题:

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:

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