1、只有IE才能识别
|
1
2
3
|
<!--[if IE]> <link type="text/css" rel="stylesheet" href="my.css" /><![endif]--> |
因为只有IE5以上的版本才开始支持IE条件注释,所有“只有IE”才能识别的意思是“只有IE5版本以上”才能识别。
2、只有特定版本才能识别
|
1
2
3
|
<!--[if IE 8]>
<link type="text/css" rel="stylesheet" href="my.css" />
<![endif]--> |
识别特定的IE版本,高了或者低了都不可以。上例只有IE8才能识别。
3、只有不是特定版本的才能识别
|
1
2
3
|
<!--[if !IE 7]>
<link type="text/css" rel="stylesheet" href="my.css" />
<![endif]--> |
上例中特定IE7版本不能识别,其他版本都能识别,当然要在IE5以上。
4、只有高于特定版本才能识别
|
1
2
3
|
<!--[if gt IE 7]>
<link type="text/css" rel="stylesheet" href="my.css" />
<![endif]--> |
上例中只有高于IE7的版本才能识别。IE7无法识别。
5、等于或者高于特定版本才能识别
|
1
2
3
|
<!--[if gte IE 7]>
<link type="text/css" rel="stylesheet" href="my.css" />
<![endif]--> |
上例中IE7和更高的版本都能识别。
6、只有低于特定版本的才能识别
|
1
2
3
|
<!--[if lt IE 7]>
<link type="text/css" rel="stylesheet" href="my.css" />
<![endif]--> |
上例中只有低于IE7的版本才能识别,IE7无法识别。
7、等于或者低于特定版本的才能识别
|
1
2
3
|
<!--[if lte IE 7]>
<link type="text/css" rel="stylesheet" href="my.css" />
<![endif]--> |
本文详细介绍了IE条件注释的使用方法,包括仅IE浏览器、特定版本、非特定版本、高于或等于特定版本、低于特定版本等场景下如何应用条件注释加载样式表。

9867

被折叠的 条评论
为什么被折叠?



