Wednesday, February 15, 2006

IE supports Conditional Comments

I came across a situation where I had to write few CSS rules (call it a hack!) to make things look the same on both IE and Firefox. I actually wrote IE specific rules in a different file with the intension to include it only when page is rendered on IE. Its quite interesting to know the support for Conditional Comments available in IE 5+.

Well the article gives the complete details about conditional comments.

Brief:
IE supports if conditional construct within the HTML comment.

Example, to include a stylesheet when HTML is displayed in IE.
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="cssfiles/forie.css"/>
<![endif]-->

<!--[if !IE 7]>
<script type="text/javascript">
document.write("<b>IE Version Used is not 7</b>");
</script>
<![endif]-->

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?