Skip to content

Instantly share code, notes, and snippets.

@eyecatchup
Created January 13, 2016 09:14
Show Gist options
  • Save eyecatchup/bbf07b5e52431b9b14d5 to your computer and use it in GitHub Desktop.
Save eyecatchup/bbf07b5e52431b9b14d5 to your computer and use it in GitHub Desktop.
Simple "hack" to be able to write CSS specifically for IE10.
<!doctype html>
<!--[if (lte IE 8) ]><html lang="de-DE" class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|!(IE)]><!--><html class="no-js" lang="de"><!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>CSS for IE 10</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
h1 { color: black; }
html[data-useragent*='MSIE 10.0'] {
/* IE10-specific styles goes here.. */
h1 { color: blue; }
}
</style>
<script>
document.documentElement.setAttribute('data-useragent', navigator.userAgent);
</script>
</head>
<body>
<h1>I'll be blue in IE 10 only and black in every other browser</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment