Select Page

I previously wrote a post showing how to target specific Internet Explorer (IE) versions using CSS hacks.

So when I came across an CSS rendering issue for a client site which only seemed to happen in IE 10/11 (really!) I thought I’d skip back and see if those hacks would work.

It was a little more challenging than I thought.

There are no specific CSS property hacks that you can add to CSS statements and Microsoft seem to have dropped the conditional comment system in IE 10 and 11.

That was a bit of a pain in the grass.

I had a look around for some solutions, many of which recommended using jQuery or JavaScript to detect the browser type and add it to the html or body class.

Surely there must be a more elegant solution.

Then I found it in media queries.

Seems like IE10 and 11 (only) support the [codelet]-ms-high-contrast[/codelet] media query.  Excellent!

[gist id=8394738]

Just pop the above media query in your css and you can now override and adjust CSS just for IE10 and IE 11.