The Example

This is a normal paragraph tag.

This one is hidden from all IE browsers that understand conditional comments.

This one is visible to all browsers and IE7, but not IE6.

This one is visible to all browsers and IE6, but not IE7.

This one has a BG of red for IE6 or below, BG of yellow for IE7, and a BG of cyan for all other browsers.

The Code


<html>
<head>

<style type="text/css">
p {font:bold 12px/17px arial;}
p.colordependency {background:cyan;}
</style>

<!--[if IE]>
<style type="text/css">
p.hidefromIE {display:none;}
</style>
<![endif]-->

<!--[if IE 6]>
<style type="text/css">
p.hidefromIE6 {display:none;}
</style>
<![endif]-->

<!--[if lte IE 6]>
<style type="text/css">
p.colordependency {background:red;}
</style>
<![endif]-->


<!--[if IE 7]>
<style type="text/css">
p.hidefromIE7 {display:none;}
p.colordependency {background:yellow;}
</style>
<![endif]-->


</head>

<body>
<p>This is a normal paragraph tag.</p>

<p class="hidefromIE">This one is visible to all browsers
and IE7, but not IE6.</p>

<p class="hidefromIE6">This one is visible to all browsers
and IE7, but not IE6.</p>

<p class="hidefromIE7">This one is visible to all browsers
and IE6, but not IE7.</p>

<p class="colordependency">BG of red for IE6 or below, BG of yellow
for IE7, and a BG of cyan for all other browsers.</p>
</body>
</html>