-
-
Save lsitters/257264 to your computer and use it in GitHub Desktop.
CSS Hacks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body:empty { | |
background: blue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
background: red; | |
} | |
@-moz-document url-prefix() { | |
body { | |
background: blue; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The following hack will target both Safari 3 and Google Chrome. | |
*/ | |
body { | |
background: red; | |
} | |
@media screen and (-webkit-min-device-pixel-ratio:0) { | |
body { | |
background: blue; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
By placing a pound(#) symbol at the beginning of a CSS property, | |
it will be ignored by all browsers except Internet Explorer. | |
This works as a general hack that will cover all versions of IE. | |
*/ | |
body { | |
background: red; | |
#background: blue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
An underscore(_) at the beginning of a CSS property works just | |
like the pound(#) symbol with the exception that it will target IE6 only. | |
*/ | |
body { | |
background: red; | |
_background: blue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
An asterisk(*) works just like the underscore with the exception | |
that it is only read in Internet Explorer 7. | |
*/ | |
html > body { | |
background: red; | |
*background: blue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* html h1 {} targets IE 6 | |
html > body h1 {} targets IE 7 and later | |
h1 {*property:value;} targets IE 7 and below | |
html > body h1 {*property:value;} targets IE 7 only |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Placing a pound(#) symbol at the end of a CSS property group will | |
cause all properties within that group and anything after the | |
pound symbol to be ignored. This does NOT work in Safari 3. | |
*/ | |
body { | |
background: blue; | |
} | |
body { | |
background: red; | |
# | |
} | |
h1 { | |
/* This style will also be ignored by Safari 2 */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment