IE10/11 3 Alternative methods after conditional comments are not supported:
method One: Use the Ie=emulateie9 property to instruct the browser to use IE9 rendering technology
IE9 is supported for conditional comments.
<meta http-equiv= "x-ua-compatible" content= "IE=EMULATEIE9" >
Add the meta tag to the head of the HTML page so that IE10/11 can identify the conditional comment, and we can write the specific CSS code like IE6/7/8. But there is a downside to this, and it is clear that the browser will be able to IE9 the rendering mode instead of the latest IE10/11 technology.
method Two: Use the media query statement +-ms-high-contrast Property
The media query statement for CSS is a high-level CSS conditional statement that can determine whether a CSS can take effect based on some property and property values. Here, we want to use a IE10/11 unique property, it is-ms-high-contrast, only IE10/11 implemented this property, it can have two values of active or none, using the following media query statement:
@media All and (-ms-high-contrast:none), (-ms-high-contrast:active) {
/ * ie10+ CSS styles go here * /
}
Firefox, Google Browser does not recognize this property, so do not execute the query in the CSS, thus achieving the effect of conditional execution.
method Three: Use JavaScript to determine the type of browser
First use JavaScript to determine whether it is IE browser, if so, on the page's
var ms_ie = false;
var ua = window.navigator.userAgent;
var old_ie = ua.indexof (' MSIE ');
var new_ie = ua.indexof (' trident/');
if ((Old_ie >-1) | | (New_ie >-1)) {
Ms_ie = true;
}
if (Ms_ie) {
Document.documentElement.className + = "ie";
}
Compatibility adjustment and control code for IE mode 360 compatibility mode