css

Conditional styles for IE10

10/07/2013

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]-->

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 */
}