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.
Regular comment:
<!--This is a comment-->
IE conditional comment:
<!--[if expression]> <![endif]-->
Reversed anti-IE comment:
<!--[if !IE]>--> <!--<![endif]-->
Reversed IE conditional comment:
<!--[if !condition]> <![IGNORE[--><![IGNORE[]]> HTML <!--<![endif]-->
Let's take a look at the elements of the IE conditional comments and then I will show some examples.
| Item | Syntax | Description |
|---|---|---|
| feature | IE | String. The only currently supported feature is the string "IE", corresponding to Internet Explorer. |
| version | number | An integer or floating point numeral, corresponding to the version of the browser |
| operator | ! | The NOT operator. This is placed immediately in front of an value or expression or feature and reverses the Boolean value of the operand. |
| comparison | feature | Returns a Boolean value of true if the feature matches the browser type. |
| comparison | feature version | Returns a Boolean value of true if the feature matches the browser type and the version number matches the browser version. |
| comparison | lt | The less-than operator. Compares values or expresssions. Returns a Boolean value of true if the first argument is less than the second argument. |
| comparison | lte | The less-than or equal to operator. Compares values or expresssions. Returns a Boolean value of true if the first argument is less than or equal to the second argument. |
| comparison | gt | The greater-than operator. Compares values or expresssions. Returns a Boolean value of true if the first argument is greater than the second argument. |
| comparison | gte | The greater-than or equal to operator. Compares values or expresssions. Returns a Boolean value of true if the first argument is greater than or equal to the second argument. |