-1

In this answer I found the next @media

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
     /* IE10+ CSS styles go here */
}

The CSS inside this media will be executed only in IE.

Can you please suggest the opposite CSS? that will execute in any browser except IE (I'm interested in IE 11)

Anton
  • 442
  • 4
  • 19
  • Media queries have [logical operators](https://css-tricks.com/logic-in-media-queries/#article-header-id-3) – MTCoster Dec 14 '18 at 12:25
  • Possible duplicate of [How to target only IE (any version) within a stylesheet?](https://stackoverflow.com/questions/28417056/how-to-target-only-ie-any-version-within-a-stylesheet) – Viira Dec 14 '18 at 12:27
  • @MTCoster can you suggest exact query? I tried different combinations with `not` but it doesn't work. I think this query is kinda of hacky and based on that other browsers will ignore it as they do not know what `-ms-high-contrast` is. – Anton Dec 14 '18 at 12:27
  • @Viira, my question is opposity of the one mentioned by you. In that questions there is no mention on how to target everything except IE (at least I haven't seen it) – Anton Dec 14 '18 at 12:29
  • Actually, why I was asking this is because I have the same problem as here and this answer helped me https://stackoverflow.com/a/19724919/1079966 – Anton Dec 17 '18 at 16:23

1 Answers1

1

You are thinking about this the wrong way around - you should just apply the styles you want and then reset them in your ie only media query

/* use this to style all browsers */
.no-ie-style {
  font-weight: bold;
  text-decoration: underline;
}

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  /* use this to reset to defaults */
  .no-ie-style {
    font-weight: normal;
    text-decoration: none;
  }
}
<div class="no-ie-style">hello</div>
Pete
  • 57,112
  • 28
  • 117
  • 166