Skip to content

Instantly share code, notes, and snippets.

@necolas
Created May 20, 2011 12:15
  • Star 6 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save necolas/982797 to your computer and use it in GitHub Desktop.
Conditional classes test cases: DRYer and Compat View icon is not displayed in IE8/9. If X-UA-Compatible header is set using a server config then ie-cc-serverconfig.html is all that is needed.
<!DOCTYPE html>
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns"
xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8">
<!--[if lt IE 7]><html class="no-js ie6"><![endif]-->
<!--[if IE 7]><html class="no-js ie7"><![endif]-->
<!--[if IE 8]><html class="no-js ie8"><![endif]-->
<!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]-->
<title>Document</title>
<style>
body {background:green;}
.ie6 body {background:red;}
.ie7 body {background:orange;}
.ie8 body {background:yellow;}
</style>
</head>
<body>
</body>
</html>
<!--[if IE]><![endif]-->
<!DOCTYPE html>
<!--[if lt IE 7]><html class="no-js ie6" lang="en"><![endif]-->
<!--[if IE 7]><html class="no-js ie7" lang="en"><![endif]-->
<!--[if IE 8]><html class="no-js ie8" lang="en"><![endif]-->
<!--[if gt IE 8]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8">
<title>Document</title>
<style>
body {background:green;}
.ie6 body {background:red;}
.ie7 body {background:orange;}
.ie8 body {background:yellow;}
</style>
</head>
<body>
<!--
by @julienw : https://github.com/paulirish/html5-boilerplate/issues/378#issuecomment-1203093
IE drops into Quirks Mode if the X-UA-Compatible header isn't set.
Less DRY but no duplication of <html> tag in source
-->
</body>
</html>
<!DOCTYPE html>
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns"
xmlns:fb="http://www.facebook.com/2008/fbml">
<!--[if lt IE 7]><html class="no-js ie6"><![endif]-->
<!--[if IE 7]><html class="no-js ie7"><![endif]-->
<!--[if IE 8]><html class="no-js ie8"><![endif]-->
<!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Document</title>
<style>
body {background:green;}
.ie6 body {background:red;}
.ie7 body {background:orange;}
.ie8 body {background:yellow;}
</style>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment