Conditional styles for IE10

As you probably know Internet Explorer 10 doesn’t support the good-old IE CSS conditional comments. This means that the below code won’t work in IE10!

<!-- Not working :-( -->
<!--[if IE 10]>
<link type="text/css" rel="stylesheet" media="all" href="/path/to/ie10.css" />
<![endif]-->Check out this Pen!

But don’t worry, you can still apply CSS styles only to IE10 by using the below syntax. Great tip, that I learned from Chris Coyer’s blog.

html[data-useragent*='MSIE 10.0'] body {
  background:#ccc; /* IE10-only */
}Check out this Pen!

4 thoughts on “Conditional styles for IE10”

  1. Hi there, you must add and attribute to the HTML code (with Javascript) in order to work. Have a look at the example above… I add the “data-useragent” attribute to the HTML root element, and then I’using the specific attribute to target IE 10.

Leave a Reply