问题
I have been using the following trick to make browser-specific HTML:
<!--[if (IE)]> <div class= "ie"> <![endif]-->
<!--[if !(IE)]><!--> <div class= "not_ie"> <!--<![endif]-->
</div>
This does not work with IE11. Any new tricks to use?
I can detect it using JavaScript:
Detecting IE11 using CSS Capability/Feature Detection
or
Object.hasOwnProperty.call(window, "ActiveXObject") && !window.ActiveXObject)
but I'm hoping to avoid that.
回答1:
IE 11 does not longer support conditional comments in your HTML code. So you have to use Javascript.
Microsoft Dev Center - IE 10+ Conditional Comments
来源:https://stackoverflow.com/questions/21204017/detect-ie11-without-javascript-in-html-css