html标签:<!--[if IE]>,,,<![endif]-->
<!--[if IE]><script type="text/javascript" src="resources/scripts/jquery.bgiframe.js"></script><![endif]-->
这是注释,说明这中间的js代码是专门针对IE所写的,解决IE兼容性问题的。
1,条件注释的基本结构和HTML的注释(< !-- --> )是一样的。因此IE以外的浏览器将会把它们看作是普通的注释而完全忽略它们。
2,IE将会根据if条件来判断是否如解析普通的页面内容一样解析 条件注释里的内容。
3,条件注释使用的是HTML的注释结构,因此他们只能使用在HTML文件里,而不能在CSS文件中使用。
用上面这段代码,只有使用IE时加载jquery.bgiframe.js。
<!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]--> <!--[if IE]> 所有的IE可识别 <![endif]--> <!--[if IE 5.0]> 只有IE5.0可以识别 <![endif]--> <!--[if IE 5]> 仅IE5.0与IE5.5可以识别 <![endif]--> <!--[if gt IE 5.0]> IE5.0以及IE5.0以上版本都可以识别 <![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]-->
!: 代表不等于;
lt: less than,小于;
lte: less than or equal to,小于或等于;
gt: greater than,大于
gte: greater than or equal to,大于或等于
本文来自博客园,作者:啊满,转载请注明原文链接:https://www.cnblogs.com/cxiaojiang/articles/14601353.html
浙公网安备 33010602011771号