Skip to content

Instantly share code, notes, and snippets.

@ridgehkr
Created May 7, 2013 13:17
Show Gist options
  • Save ridgehkr/5532491 to your computer and use it in GitHub Desktop.
Save ridgehkr/5532491 to your computer and use it in GitHub Desktop.
Use this code in your document head to disable Compatibility Mode in IE 9 and older while still getting IE version classes. Anything that comes before the meta tag disabling Compatibility Mode will in turn cause IE to ignore that meta directive. Conditional comments around the opening body tag gets around this problem, so that's what I've done i…
<!DOCTYPE html>
<html lang='en' class='no-js'>
<head>
<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
<!-- title, other meta, style, and script tags follow here -->
<!-- if you need detection for >= IE10, use my script here: https://gist.github.com/ridgehkr/5985810 -->
</head>
<!--[if IE 7]> <body class="ie7 lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <body class="ie8 lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <body> <!--<![endif]-->
<!-- page content -->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment