Skip to content

Instantly share code, notes, and snippets.

@eriwen
Created September 6, 2011 15:49
Show Gist options
  • Save eriwen/1197941 to your computer and use it in GitHub Desktop.
Save eriwen/1197941 to your computer and use it in GitHub Desktop.
CSS Browser targeting
/* IE6 and below & Mac IE */
* html selector{ prop: value; }
/* IE6 and below */
/*\*/
* html selector{ prop: value; }
/**/
/* IE7 */
*:first-child+html selector{ prop: value; }
*+html selector { prop: value; }
/* Mac IE only */
/*\*//*/
selector{property:value;}
/**/
/* IE 7 and modern browsers */
html>body selector { prop: value; }
/* Modern browsers (not IE 7) */
html>/**/body selector { prop: value; }
/* Opera 9.27 and below */
html:first-child selector { prop: value; }
/* Safari */
html[xmlns*=""] body:last-child #seis { prop: value; }
/* safari 3+, chrome 1+, opera9+, ff 3.5+ */
body:nth-of-type(1) selector { prop: value; }
body:first-of-type #ocho { prop: value; }
/* Safari 3 and Chrome 1+ */
@media screen and (-webkit-min-device-pixel-ratio:0) { prop: value; }
/* All IE versions */
selector { width: 100px\9; }
/ * IE8 Standards Mode only */
selector { width /*\**/: 100px\9; }
#box {
margin-left: 20px; /* all browsers including Mac IE */
*margin-left: 22px; /* IE 7 and below */
_margin-left/**/:/**/ 18px; /* IE 6 only */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment