is there any IE8 only css hack?

Jitendra Vyas picture Jitendra Vyas · Jun 15, 2010 · Viewed 104.1k times · Source

For Internet Explorer 8 (IE8) I'd like to use the following CSS:

color : green;

I would like to apply a hack which only affects IE8, not to IE9, IE6 and 7.

Answer

Palantir picture Palantir · Jun 15, 2010

Use conditional comments in HTML, like this:

<!--[if IE 8]>
<style>...</style>
<![endif]-->

See here: http://www.quirksmode.org/css/condcom.html

You can test for IE versions reliably and also be sure other browsers won't be confused.