很多网页中会见到这样的代码:

<!--[if IE 7]>
<![endif]--> /*或者*/ <!--[if lt IE 9]>
<![endif]-->

其他浏览器会将其作为注释而忽略这些语句,因为他们是IE专门提供的一种语法,如此就能根据不同的IE版本加载对应的CSS或者JS文件了。

语法解释:

<!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]-->
<!--[if IE]> 所有的IE可识别 <![endif]-->
<!--[if IE 6]> 仅IE6可识别 <![endif]-->
<!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]-->
<!--[if gte IE 6]> IE6以及IE6以上版本可识别 <![endif]-->
<!--[if IE 7]> 仅IE7可识别 <![endif]-->
<!--[if lt IE 7]> IE7以及IE7以下版本可识别 <![endif]-->
<!--[if gte IE 7]> IE7以及IE7以上版本可识别 <![endif]-->
<!--[if IE 8]> 仅IE8可识别 <![endif]-->
<!--[if IE 9]> 仅IE9可识别 <![endif]-->

属性:

项目 范例 说明
! [if !IE] The NOT operator. This is placed immediately in front of the featureoperator, or subexpression to reverse the Boolean meaning of the expression.
NOT运算符。这是摆立即在前面的功能操作员,或子表达式扭转布尔表达式的意义。
lt [if lt IE 5.5] The less-than operator. Returns true if the first argument is less than the second argument.
小于运算符。如果第一个参数小于第二个参数,则返回true。
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.
小于或等于运算。如果第一个参数是小于或等于第二个参数,则返回true。
gt [if gt IE 5] The greater-than operator. Returns true if the first argument is greater than the second argument.
大于运算符。如果第一个参数大于第二个参数,则返回true。
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.
大于或等于运算。如果第一个参数是大于或等于第二个参数,则返回true。
( ) [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
AND运算符。如果所有的子表达式计算结果为true,返回true
| [if (IE 6)|(IE 7)] The OR operator. Returns true if any of the subexpressions evaluates to true.
OR运算符。返回true,如果子表达式计算结果为true。

HTML条件注释判断<!--[if IE] ![endif]-->的更多相关文章

  1. HTML条件注释判断浏览器版本命令

    <!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]--> <!--[if IE]> 所有的IE可识别 <![ ...

  2. 通过HTML条件注释判断IE版本的HTML语句详解<!--[if IE]> <![endif]-->

    我们常常会在网页的HTML里面看到形如[if lte IE 9]……[endif]的代码,表示的是限定某些浏览器版本才能执行的语句,那么这些判断语句的规则是什么呢?请看下文: <!--[if ! ...

  3. 条件注释判断IE浏览器

    最近在用jquery 2.0 才知道已不支持IE6/7/8 但又不想换回 jquery 1.X; 找了一资料发现条件注释可以解决这个问题 这个也像程序中的条件判断,先来介绍几个单词lt :Less t ...

  4. 使用条件注释判断 IE 浏览器版本

    IE条件注释是一种特殊的HTML注释,这种注释只有IE5.0及以上版本才能理解.比如普通的HTML注释是: <!--This is a comment--> 而只有IE可读的IE条件注释是 ...

  5. 条件注释判断IE版本

    在学习Bootstra的时候看到这么一句话, <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media ...

  6. 条件注释判断IE浏览器版本

    lt,lte,gt,gte分别表示什么 lt:小于当前版本 lte:小于或等于当前版本,包括本身 gt:大于当前版本 gte:大于或等于当前版本,包括本身 使用格式 // 如IE9以下(不包括IE9加 ...

  7. HTML中IE条件注释判断语句(<!--[if XX IE X]><![endif]-->)

    <!--[if XX IE X]><![endif]-->是IE专门提供的一种语法,其他浏览器会将其作为注释而忽略这些语句.   作用: 根据不同的IE版本加载对应的CSS或者 ...

  8. IE条件注释判断

    相信大家都知道IE有专门的注释条件判断来引入一些css.js.html代码,但是语法有点拗口,记不住,下面我来做一下笔记: 正常的html注释: <!--注释注释注释注释...--> 注释 ...

  9. 条件注释判断浏览器版本<!--[if lt IE 9]>

    <!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]--><!--[if IE]> 所有的IE可识别 <![e ...

随机推荐

  1. 多实例mysql的安装和管理

    多实例mysql的安装和管理 http://blog.chinaunix.net/uid-20639775-id-3438560.html mysql的多实例有两种方式可以实现,两种方式各有利弊.第一 ...

  2. 百度地图javascript API,每个功能每天免费的次数

  3. hdu 1533 Going Home 最小费用最大流 (模板题)

    Going Home Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  4. SQL添加列、非空、默认值

    use MarcoBarcode go alter table [dbo].[WorkOrderRepairSheet] ADD needRepair int go ALTER TABLE [dbo] ...

  5. delphi10.2 命令行编译x64脚本

    Build.bat @echo off @echo delphi x64编译测试 @cd /d %~dp0 @echo 设置Delphi参数信息 @set SourcePath=%~dp0.\src ...

  6. Job for nginx.service failed because the control process exited with error code. See “systemctl stat

    启动nginx服务时如果遇到这个错误 Job for nginx.service failed because the control process exited with error code. ...

  7. 吴裕雄--天生自然java开发常用类库学习笔记:同步与死锁

    class MyThread implements Runnable{ private int ticket = 5 ; // 假设一共有5张票 public void run(){ for(int ...

  8. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 字体图标(Glyphicons):glyphicon glyphicon-signal

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name ...

  9. POJ 2287 田忌赛马

    Tian Ji -- The Horse Racing Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 17699   Acc ...

  10. 强制数据类型转换 字符串/数字/boolean

    类型转换主要指,将其他数据类型转换为(String.Number.Boolean) 类型转换有显式类型转换 和隐式类型转换 显式类型转换 1.1转换为string 调用数据的 toString() 方 ...