1

I am looking for a way to hide div in IE11 and lower, but still have it display in Edge and other browsers.

Is it best to hide elements like this using Javascript?

Any direction would be appreciated.

zeropsi
  • 682
  • 9
  • 24
  • 4
    Does this answer your question? [How can you detect the version of a browser?](https://stackoverflow.com/questions/5916900/how-can-you-detect-the-version-of-a-browser) – ikiK Jun 23 '20 at 23:22
  • Yes, found out type and (if you want) version of browser with JS and hide element with it. CSS can not help you here much (I believe)... – ikiK Jun 23 '20 at 23:26
  • Does this answer your question? [Detecting IE11 using CSS Capability/Feature Detection](https://stackoverflow.com/questions/18907131/detecting-ie11-using-css-capability-feature-detection) – user120242 Jun 23 '20 at 23:55
  • And https://stackoverflow.com/questions/20541306/how-to-write-a-css-hack-for-ie-11 – user120242 Jun 23 '20 at 23:56

1 Answers1

1

http://browserhacks.com/

IE8-11:

@media screen\0 {
  body { display: none };
}

IE <= 8:

@media \0screen\,screen\9 { body { display: none } }

Detecting IE11 using CSS Capability/Feature Detection
@JanKyuPeblik:

This works because IE11 doesn't actually even support @supports, and all other relevant browser/version combinations do.

body { display:none }
/**/@supports not (old: ie) {
body { display:unset }
/**/}
user120242
  • 14,918
  • 3
  • 38
  • 52