Special Css for Internet Explorer

IE conditional comments like <!--[if IE 8 ]>some text <![endif]--> will no longer work on IE10 and IE11.

For IE versions less than 10 we could use

<!--[if IE 8 ]> <html class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="no-js ie9"> <![endif]--> 

The above condition is used to add the conditional class for the IE versions 8 and 9, on basis of which we can add special css for these IE versions. This method is not supported anymore by IE10+.

 

What do we do for adding special css only for IE10 and more?

We know that IE10 and later versions are much advanced, but still it needs some special styles for special cases, In order to put conditional css for IE10 and 11 we can now use a special media query

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

this works fine with IE10 and later version, and for versions 9 and lesser we can still use the old conditional comment method.