Internet Explorer hacks

.class {
width:200px; /* All browsers */
*width:250px; /* IE */
_width:300px; /* IE6 */
.width:200px; /* IE7 */
}

Advertisements

Conditional stylesheets

<!--[if lte IE 8]><link rel="stylesheet" href="lte-ie-8.css"><![endif]--> <!--[if lte IE 7]><link rel="stylesheet" href="lte-ie-7.css"><![endif]--> <!--[if lte IE 6]><link rel="stylesheet" href="lte-ie-6.css"><![endif]-->
**************************************************************************
/* Main stylesheet */ .foo { color: black; } /* lte-ie-8.css, for IE8 and older */ .foo { color: green; } /* lte-ie-7.css, for IE7 and older */ .foo { color: blue; } /* lte-ie-6.css, for IE6 and older */ .foo { color: red; }
**************************************************************************
<!--[if lt IE 7]><html><![endif]-->
<!--[if IE 7]>   <html><![endif]--> <!--[if IE 8]>   <html><![endif]--> <!--[if gt IE 8]><!--><html><!--<![endif]-->
**************************************************************************
.foo { color: black; }
.ie8 .foo { color: green; } /* IE8 */ .ie7 .foo { color: blue; } /* IE7 */ .ie6 .foo { color: red; } /* IE6 and IE5 (but who cares, right?) */
**************************************************************************
.foo {
  color: black;   color: green\9; /* IE8 and older, but there’s more… */   *color: blue; /* IE7 and older */   _color: red; /* IE6 and older */ }
**************************************************************************