Skip to content

Instantly share code, notes, and snippets.

@villadora
Created July 12, 2012 04:03
Show Gist options
  • Save villadora/3095664 to your computer and use it in GitHub Desktop.
Save villadora/3095664 to your computer and use it in GitHub Desktop.
Stylesheet cheat for IE

For All IE

<!--[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie-only.css" />
<![endif]-->

Target everything EXCEPT IE

<!--[if !IE]><!-->
<link rel="stylesheet" type="text/css" href="not-ie.css" />
<!--<![endif]-->

Target IE 7 ONLY

<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="ie7.css">
<![endif]-->

Target IE 8 and LOWER

gt,gte,..

Hacks

IE-6 ONLY

* html #div { 
    height: 300px;
}

IE-7 ONLY

*+html #div { 
    height: 300px;
}

IE-8 ONLY

#div {
  height: 300px\0/;
}

IE-7 & IE-8

#div {
  height: 300px\9;
}

NON IE-7 ONLY:

#div {
   _height: 300px;
}

Hide from IE 6 and LOWER:

#div {
   height/**/: 300px;
}

html > body #div {
   height: 300px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment