识别IE浏览器版本后才会加载代码

<!--[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]-->

lte:就是Less than or equal to的简写,也就是小于或等于的意思。

lt :就是Less than的简写,也就是小于的意思。

gte:就是Greater than or equal to的简写,也就是大于或等于的意思。

gt :就是Greater than的简写,也就是大于的意思。

 

因为IE各版本的浏览器对我们制作的WEB标准的页面解释不一样,具体就是对CSS的解释不同,我们为了兼容这些,可运用条件注释来各自定义,最终达到兼容的目的。比如:

<!-- 默认先调用css.css样式表 -->

 

<link rel="stylesheet" type="text/css" href="css.css" />

 

<!--[if IE 7]>

 

<!-- 如果IE浏览器版是7,调用ie7.css样式表 -->

 

<link rel="stylesheet" type="text/css" href="ie7.css" />

 

<![endif]-->

 

<!--[if lte IE 6]>

 

<!-- 如果IE浏览器版本小于等于6,调用ie.css样式表 -->

 

<link rel="stylesheet" type="text/css" href="ie.css" />

 

<![endif]-->

 

posted @ 2014-01-11 17:04  宇文雅昕  阅读(122)  评论(0)    收藏  举报