HTML conditional Comment Judgment Browser version command summary

Source: Internet
Author: User
Tags html validator versions

Pse:collapse; font:14px/24px ' Trebuchet MS ', Helvetica, ' Microsoft Yahei ', Georgia, Sans-serif; White-space:normal; Orphans:2; Letter-spacing:normal; Color:rgb (68,68,68); word-spacing:0px; -webkit-text-size-adjust:none; -webkit-text-stroke-width:0px "border=" 1 "width=" 100% "> Project Example Description

! [If! IE] Not operator. This is the pendulum immediately in front of the function, operator, or subexpression to reverse the meaning of the Boolean expression.
Lt [if Lt IE 5.5] is less than the operator. Returns true if the first argument is less than the second argument.
LTE [If LTE IE 6] is less than or equal to the operation. Returns true if the first argument is less than or equal to the second argument.
The GT [if GT IE 5] is greater than the operator. Returns true if the first argument is greater than the second argument.
GTE [if GTE IE 7] is greater than or equal to the operation. Returns true if the first argument is greater than or equal to the second argument.
() [If! (IE 7)] Child expression Operators. Used with Boolean operators to create more complex expressions.
& [if (GT IE 5) & (LT IE 7)] and operator. Returns true if all the subexpression evaluates to True.
| [If (IE 6) | (IE 7)] (www.45it.net) or operator. Returns True if the subexpression evaluates to True.


Practical Example:
<!--[if! ie]><!--> can recognize <!--<! except IE [endif]-->
<!--[if ie]> all IE identifiable <! [endif]-->
<!--[if IE 6]> only IE6 identifiable <! [endif]-->
<!--[if Lt IE 6]> IE6 and IE6 The following versions can be identified <! [endif]-->
<!--[if GTE IE 6]> IE6 and IE6 above versions can be identified <! [endif]-->
<!--[if IE 7]> only IE7 identifiable <! [endif]-->
<!--[if Lt IE 7]> IE7 and IE7 The following versions can be identified <! [endif]-->
<!--[if GTE IE 7]> IE7 and IE7 above versions can be identified <! [endif]-->
<!--[if IE 8]> only IE8 identifiable <! [endif]-->
<!--[if IE 9]> only IE9 identifiable <! [endif]-->

Extending knowledge:
<!--[If Lt IE 9]>
Load CSS1
<!--[else]>
Load CSS2
<! [endif]-->
Note: This is valid, but in HTML validator, the error, because this does not conform to the XHTML 1.1 specification,
If you remove the Else statement, it is correct.

The above problem solution one:
Load CSS2
<!--[If Lt IE 9]>
Load CSS1 (You can write the rewrite here).
<! [endif]-->

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.