HTML page IE comments

Source: Internet
Author: User
Tags html validator

We often see the form in the HTML of the page like [if LTE IE 9] ... The code for [ENDIF] represents a statement that restricts certain browser versions to execute, so what are the rules for these judgment statements? Please see below:

<!--[if! ie]><!--> In addition to IE can be recognized <!--<! [endif]-->
<!--[if ie]> all IE recognizable <! [endif]-->
<!--[if IE 6]> only IE6 recognizable <! [endif]-->
<!--[if Lt IE 6]> IE6 and IE6 The following versions are recognized <! [endif]-->
<!--[if GTE IE 6]> IE6 and IE6 above are recognized <! [endif]-->
<!--[if IE 7]> only IE7 recognizable <! [endif]-->
<!--[if Lt IE 7]> IE7 and IE7 The following versions are recognized <! [endif]-->
<!--[if GTE IE 7]> IE7 and IE7 above are recognized <! [endif]-->
<!--[if IE 8]> only IE8 recognizable <! [endif]-->
<!--[if IE 9]> only IE9 recognizable <! [endif]-->

Project Example Description
! [If! IE] The NOT operator. This was placed immediately in front of the feature, operator, or subexpression to reverse the Boolean meaning of the Expre Ssion.
Not operator. This is the meaning of a Boolean expression that swings immediately in front of the function, operator, or sub-expression.
Lt [If Lt IE 5.5] The Less-than operator. Returns true if the first argument is less than the second argument.
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.
Less than or equal to the operation. Returns true if the first parameter 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.
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.
Greater than or equal to the operation. Returns true if the first parameter is greater than or equal to the second argument.
( ) [If! (IE 7)] subexpression operators. Used in conjunction with the Boolean operators to create more complex expressions.
Sub-expression operator. Used in 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
And operator. Returns true if all sub-expressions evaluate to True
| [If (IE 6) | (IE 7)] The OR operator. Returns true if any of the subexpressions evaluates to True.
Or operator. Returns true if the sub-expression evaluates to True.

<!--[If Lt IE 9]>
Load CSS1
<!--[else]>
Load CSS2
<! [endif]-->

This is effective, but in HTML validator, error, because this does not conform to XHTML 1.1 specification,
If the Else statement is removed, it is correct.

Method 1:

Load CSS2
<!--[If Lt IE 9]>
Load the CSS1 (you can put the rewrite to write here).
<! [endif]-->

<!--[If LTE IE 6]><! [Endif]-->ie6 and the following versions are visible  <!--[if LTE IE 7]><! [Endif]-->ie7 and the following versions are visible  <!--[if IE 6]><! [endif]--> only IE6 version visible  <! [If! ie]><! [endif]> except IE version  <!--[if Lt IE 8]><! [ENDIF]--&GT;IE8 and the following versions are visible  <!--[if GTE IE 7]><! [Endif]-->ie7 and the following versions are visible   usage: (1) You can use the following code to detect the current version of IE browser (note: In non-IE browser is not visible) <!––[if ie]>        

If the current browser is IE, but the version is lower than IE5, how to do it, you can use <!–[if ls ie 5]>, of course, according to the conditional annotation can only be in the ie5+ environment, so <!–[if ls ie 5]> will not be executed at all.

LTE: is less than or equal to the shorthand, that is, smaller than or equal to the meaning. LT: is less than shorthand, that is, smaller than the meaning. GTE: is greater than or equal to the shorthand, that is, greater than or equal to the meaning.

GT: is greater than shorthand, that is, the meaning of greater than.

! : Is not equal to the meaning of the JavaScript is not equal to the same judge

HTML page IE comments

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.