Syntax of Conditional Comments
The basic syntax of each type of comment is shown in the following table. The first comment shown is the basic HTML Comment, which is included for the purpose of comparison and to illustrate the different syntax used by each type of conditional comment.
Comment type | Syntax or possible value |
---|---|
standard HTML comment | <!-- Comment content --> |
downlevel-hidden | <!--[if expression]> HTML <![endif]--> |
downlevel-revealed | <![if expression]> HTML <![endif]> |
The HTML shown inside the syntax block in each of the conditional comments denotes any block of HTML content, including script. Both types of conditional comment use a conditional expression to indicate whether the content inside the comment block should be parsed or ignored.
The conditional expression is formed from a combination of feature, operator, and/or value, as shown in the following table.
Item | Example | Comment |
---|---|---|
IE | [if IE] | The only currently supported feature is the string "IE", corresponding to Internet Explorer. |
value | [if IE 7] | An integer or floating point numeral corresponding to the version of the browser. Returns a Boolean value of true if the version number matches the browser version. For more information, see Version Vectors. |
! | [if !IE] | The NOT operator. This is placed immediately in front of the feature, operator, or subexpression to reverse the Boolean meaning of the expression. |
lt | [if lt IE 5.5] | The less-than operator. Returns true if the first argument is less than the second argument. |
lte | [if lte IE 6] | The less-than or equal operator. Returns true if the first argument is less than or equal to the second argument. |
gt | [if gt IE 5] | The greater-than operator. Returns true if the first argument is greater than the second argument. |
gte | [if gte IE 7] | The greater-than or equal operator. Returns true if the first argument is greater than or equal to the second argument. |
( ) | [if !(IE 7)] | Subexpression operators. Used in conjunction with boolean operators to create more complex expressions. |
& | [if (gt IE 5)&(lt IE 7)] | The AND operator. Returns true if all subexpressions evaluate to true |
| | [if (IE 6)|(IE 7)] | The OR operator. Returns true if any of the subexpressions evaluates to true. |
true | [if true] | Always evaluates to true. |
false | [if false] | Always evaluates to false. |
http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx
'Bookmarks' 카테고리의 다른 글
TCP/IP (0) | 2009.08.20 |
---|---|
20 HQ Free Flower Photoshop Brushes (6) | 2009.05.26 |
네이버 숨은 손글씨 찾기 공모전 (11) | 2009.05.26 |
Recent Comments