IE6 is a worse dream for every web developers. Good news is that Software giant Microsoft has released a new website with the expressed aim of killing off its Internet Explorer 6 browser.
Still we have to deal with IE7 to IE9
Here is some way to cut down your development time by easily detecting IE.
IE Conditional Comments
It is the most commonly used to fix the IE bugs for specific versions (IE6, IE7, IE8,IE9)
[code lang=”css”] // Target all version of IE<!–[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie.css" />
<![endif]–>
//Target everything except IE
<!–[if !IE]><!–>
<link rel="stylesheet" type="text/css" href="not-ie.css" />
<!–<![endif]–>
//Target IE 6 only
<!–[if IE 6]>
<link rel="stylesheet" type="text/css" href="ie6.css" />
<![endif]–>
//Target IE 7 only
<!–[if IE 7]>
<link rel="stylesheet" type="text/css" href="ie7.css">
<![endif]–>
//Target IE 8 and lower
<!–[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="ie8-and-down.css" />
<![endif]–>
<!–[if lte IE 8]>
<link rel="stylesheet" type="text/css" href="ie8-and-down.css" />
<![endif]–>
//Target IE 8 and higher
<!–[if gt IE 7]>
<link rel="stylesheet" type="text/css" href="ie8-and-up.css" />
<![endif]–>
<!–[if gte IE 8]>
<link rel="stylesheet" type="text/css" href="ie8-and-up.css" />
<![endif]–>
[/code]
CSS Rules Specific
Its an way if you just want to do small changes on you css file in a quick way.
[code lang=”css”] .wrapper {background: red; /* standard */
background: green\9; /* IE 8 and below */
*background: blue; /* IE 7 and below */
_background: black; /* IE 6 */
}
[/code]
Conditional HTML Class
Paul Irish found a way and it doesn’t cause any validation errors! I think this is best.
[code lang=”css”] <!–[if lt IE 7 ]> <html class="ie6"> <![endif]–><!–[if IE 7 ]> <html class="ie7"> <![endif]–>
<!–[if IE 8 ]> <html class="ie8"> <![endif]–>
<!–[if IE 9 ]> <html class="ie9"> <![endif]–>
<!–[if (gt IE 9)|!(IE)]><!–> <html> <!–<![endif]–>
[/code]