Construct a series of style sheets in a cascading manner as shown below:
<link id="stylesheet1" rel="stylesheet" href="css/style.css" type="text/css" media="all" /
<!--[if IE]>
<link id="stylesheet2" rel="stylesheet" href="css/ie.css" type="text/css" media="all" />
<![endif]-->
<!--[if lte IE 6]>
<link id="stylesheet3" rel="stylesheet" href="css/ie6.css" type="text/css" media="all" />
<![endif]-->
<!--[if lte IE 5]>
<link id="stylesheet4" rel="stylesheet" href="css/ie5.css" type="text/css" media="all" />
<![endif]-->
Contents of style.css:
.myclass{
width:100px;
}
Contents of ie.css:
/* modify class from style.css */
.myclass{
width:105px;
}
Contents of ie6.css:
/* further alter class from ie.css */
.myclass{
width:110px;
}
Contents of ie5.css:
/* if needed, amend class again from ie6.css */
.myclass{
width:115px;
}
Only make changes where necessary.
Pekka's advice is valid - address each issue individually and adjust styles accordingly for different versions of Internet Explorer. If something doesn't render correctly in IE6, tweak it in ie6.css
. If the problem persists in IE5, make adjustments in ie5.css
.
With practice, you'll gain better understanding.
Explanation:
<!--[if IE]>
content inside these tags will only be visible to Internet Explorer browsers (all versions)
<![endif]-->
<!--[if lte IE 6]>
content inside these tags will only be visible to Internet Explorer 6 or earlier versions
<![endif]-->
<!--[if lte IE 5]>
content inside these tags will only be visible to Internet Explorer 5 or earlier versions
<![endif]-->