2013年5月8日 星期三

IE Conditional Comments


Following is from the http://haslayout.net/condcom, more detail can reference it

Overview

IE Conditional Comments (or condcom for short) are special comments that enable authors to use the instructions that only Internet Explorer 5.0 and above on Windows platform will see.

Various types of conditional comments

Regular comment:
<!--This is a comment-->
IE conditional comment:
<!--[if IE]> <![endif]-->
Reversed anti-IE comment:
<!--[if !IE]>--> non-IE HTML Code <!--<![endif]-->
Reversed IE conditional comment (rarely needed):
<!--[if ! lt IE 7]>
    <![IGNORE[--> <![IGNORE[]]>
        Code for browsers that match the if condition
<!--<![endif]-->
In a nutshell, any browser except Internet Explorer on a Windows platform will treat conditional comment as a regular HTML comment. You cannot use condcoms in the CSS code itself. IE conditional comments are useful for hiding or revealing the code to IE, which in turn allows authors to use CSS "hacks" in a more appropriate fashion.



沒有留言:

張貼留言