Home  >  Article  >  Web Front-end  >  面向XHTML的IE条件注释_HTML/Xhtml_网页制作

面向XHTML的IE条件注释_HTML/Xhtml_网页制作

WBOY
WBOYOriginal
2016-05-16 16:45:321384browse

条件注释是IE特有的一种功能,能对IE系列产品进行单独的XHTML代码处理,注意,主要是针对XHTML,而非CSS。
条件注释功能非常强大,可以进行true和false判断,例如:
程序代码


条件注释能被IE判断是什么版本的浏览器,并在符合条件的情况下显示其中的内容,从IE5.0到7.0都支持注释功能,而且版本号精确到小数点后4位:
程序代码

IE条件注释还支持感叹号非操作:
程序代码

并且支持前缀,用于判断更高版本或是更低版本:
程序代码

这里的gt全称为greater than表示当前条件版本以上版本,但不包含当前版本。
还有其它几个前缀:
lt 表示less than 当前条件版本以下的版本,不包含当前版本。
gte 表示greeter than or equal 当前版本以上版本,并包含当前版本。
lte 表示less than or equal 当前版本以下版本,并包含当前版本。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn