HTML中的IE条件注释语句

用法:

<!--[if IE 8]>
Welcome to Internet Explorer 8.
<![endif]-->

解释语句如下:

! = The NOT operator. This is placed immediately in front of the feature, operator, or subexpression to reverse the Boolean meaning of the expression.(除了…选择所有)

lt = The less-than operator. Returns true if the first argument is less than the second argument.(低于)

lte = The less-than or equal operator. Returns true if the first argument is less than or equal to the second argument.(低于等于)

gt = The greater-than operator. Returns true if the first argument is greater than the second argument.(高于)

gte = The greater-than or equal operator. Returns true if the first argument is greater than or equal to the second argument.(高于等于)

( ) = Subexpression operators. Used in conjunction with boolean operators to create more complex expressions.

& = The AND operator. Returns true if all subexpressions evaluate to true

| = The OR operator. Returns true if any of the subexpressions evaluates to true.

实际应用:

  • 选择IE5.01版,可以用"<!--[if ie 5.0]>"
  • 选择IE5.5,IE6.0,IE7.0,可以用"<!--[if !ie 5.0]>"
  • 选择IE5.5,可以用"<!--[if ie 5.5000]>"
  • 选择IE 5.01,IE6 ,IE7.0,可以用"<!--[if !IE 5.5000]>"
  • 选择IE 6,可以用"<!--[if IE 6]>"
  • 选择IE 5.01,IE5.5和IE7.0 ,可以用"<!--[if !IE 6]>"
  • 选择IE 7.0,可以用"<!--[if IE 7.0]>"
  • 选择IE 5.01,和IE5.5和IE6 ,可以用"<!--[if lte IE 6]>"
  • 选择IE 5.01和IE5.5,可以用"<!--[if IE 5]>"
  • 选择IE 6和IE7.0,可以用"<!--[if !IE 5]>"
  • 选择IE 5.01和IE5.5和IE6和IE7.0,用"<!--[if lte IE 7.0]>"

参考资料:http://msdn.microsoft.com/en-us/library/ms537512.aspx

一月 16, 2011 | In: 网页

Comment Form

You must be logged in to post a comment.