Skip to content

Instantly share code, notes, and snippets.

@evaisse
Created October 27, 2009 18:11
Show Gist options
  • Save evaisse/219794 to your computer and use it in GitHub Desktop.
Save evaisse/219794 to your computer and use it in GitHub Desktop.
CSS HACK
* html {
/* will affect IE6 only */
}
*+html, * html {
/* will affect IE 7 and older version */
}
*+html {
/* will affect IE 7 only */
}
html>body {
/* will affect IE 7 and modern browsers */
}
html>/**/body {
/* will affect modern browsers only ( without IE 7 :) ) */
}
.test { color /*\**/: blue\9
/* will affect IE8 Standards-Mode Only */
}
.example {
color: blue\9
/* will affect ALL IE VERSIONS,
including IE8 "Standards" Mode */
}
html:first-child {
/* Recent Opera versions 9 and below */
}
#attrhack[disabled=""]+p {
/*
Firefox 1.5 and below, possibly future versions
Safari 2.0 and below, possibly future versions
Konqueror 3.5 and below, possibly future versions
*/
}
#attrhack[disabled="true"]+p {
/* Opera 9 and below, possibly future versions */
}
p {
background: green !important; /* Major browsers other than IE 6 and
below respect the importance immediately */
background: red; /* IE 6 and below use this value instead,
even though the above was marked as important */
}
body[class|="page-body"] {
/*
selects the body element with the class page-body in IE 7
and all modern browsers except Opera 9 and below. It may
or may not work in future versions.
*/
}
/****
_______ _______ _______ _______ _______ _
( ____ \( ____ \( ____ \ |\ /|( ___ )( ____ \| \ /\
| ( \/| ( \/| ( \/ | ) ( || ( ) || ( \/| \ / /
| | | (_____ | (_____ | (___) || (___) || | | (_/ /
| | (_____ )(_____ ) | ___ || ___ || | | _ (
| | ) | ) | | ( ) || ( ) || | | ( \ \
| (____/\/\____) |/\____) | | ) ( || ) ( || (____/\| / \ \
(_______/\_______)\_______) |/ \||/ \|(_______/|_/ \/
Credits :
- http://www.webdevout.net/css-hacks
- http://my.opera.com/dbloom/blog/2009/03/11/css-hack-for-ie8-standards-mode
****/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment