How to Target IE6, IE7, and IE8 Uniquely with 4 Characters [CSS Hacks]

Some interesting new CSS hacks:

body {
	color: red; /* all browsers, of course */
	color : green9; /* IE8 + IE9 and below */
	*color : yellow; /* IE7 and below */
	_color : orange; /* IE6 */
}

Sure, specific CSS should be served using conditional comments, but every so often, a good ol’ CSS hack is just so useful.

[Update]: The IE8 hack no longer works. Here’s a working one courtesy of Paul Irish:

@media screen {
	body {
		color: green; /* IE8 */
	}
}
@media screen {
	body {
		color: green; /* IE8 and IE9 */
	}
}

6 thoughts on “How to Target IE6, IE7, and IE8 Uniquely with 4 Characters [CSS Hacks]”

  1. mo says:

    Been back to this page plenty of times haha

  2. aaaaa says:

    thanks so much 🙂

  3. Abe says:

    Thank you!

  4. Thank you very much after surfing Got solution!!!!!!!!!!!!!!

Comments are closed.