根据条件判断,这是Internet Explorer 6<br />
< ![endif]-->
<!--[if IE 7]>
根据条件判断,这是Internet Explorer 7<br />
< ![endif]-->
<!--[if gte IE 5]>
根据条件判断,这是Internet Explorer 5 或者更高<br />
< ![endif]-->
<!--[if lt IE 6]>
根据条件判断,这是版小于6的Internet Explorer<br />
< ![endif]-->
<!--[if lte IE 5.5]>
根据条件判断,这是Internet Explorer 5.5或更低<br />
< ![endif]-->
下面的代码是在非IE浏览器下运行的条件注释
<!--[if !IE]><!-->
您使用不是 Internet Explorer<br />
<!--<![endif]-->
<!--[if IE 6]><!-->
您正在使用Internet Explorer version 6<br />
或者 一个非IE 浏览器<br />
<!--<![endif]-->
下面是条件注释的语法:
[list]
[*]gt /Greater than/大于/<!--[if gt IE 5.5]>
[*]gte /Greater than or equal to/大于等于/<!--[if gte IE 5.5]>
[*]lt /Less than/小于/<!--[if lt IE 5.5]>
[*]lte /Less than or equal to/小于等于/<!--[if lte IE 5.5]>
[*]! /Note/不等于/<!--[if !IE 5.5]>
[/list]
IE条件注释的优秀的区分浏览器的能力,让很多设计师用于hack,解决浏览器对CSS解析的不同
<!--[if IE6.0]]
<style type="text/css">
div#box{width:500px;margin:10px; padding:10px; border:10px;}
</style>
<![endif]-->
<!--[if lt IE6.0]]
<style type="text/css">
div#box{width:530px;margin:10px; padding:10px; border:10px;}
</style>
上面提到了条件注释,就是判断浏览器类型,然后定义什么浏览器下显示什么内容。
这个
| 对此文章发表了评论 |
