关于ie浏览器的css代码注释
2008-09-11 11:25
225 查看
使用条件注释有四点好处:是不支持条件注释的浏览器跳过而不解西;不需要脚本来分辨浏览器的版本;能按逻辑来划分代码;跨浏览器使用 三种注释格式: standard HTML comment
<!-- Comment content -->
downlevel-hidden
<!--[if expression]> HTML <![endif]-->
downlevel-revealed
<![if expression]> HTML <![endif]>
所谓的dowmlevel也就是低于IE5。0的版本
条件表达式的运算符:
有一点要注意的就是在downlevel-revealed conditional comment中:(我就写出例子来不写那些解释了一看就明白)
<!--[if IE 7]>--> <h1>jkfjk</h1> <!--<![endif]-->
<!--[if IE 7]><!--> <h1>jkfjk</h1> <!--<![endif]-->
上面的代码你在IE浏览器中使用就会发现有区别了,IE的解决方法就是在前一个的前面加上了"<!"。
还有一个就是IE的版本号在小数点后又四位数,5.0453是正确的,5.0.4.5.3是错误的。但是随win2000发布的IE版本号是5.0002,只这一个特例。 呵呵,英语水平有限,有不对的地方还请指点,希望各位高手给这个板块加点人气。
本文来自: CSSPLAY中文官方网(http://www.cssplay.org.cn/) 详细出处参考:http://www.cssplay.org.cn/css-hack/20080227/96.html
<!-- Comment content -->
downlevel-hidden
<!--[if expression]> HTML <![endif]-->
downlevel-revealed
<![if expression]> HTML <![endif]>
所谓的dowmlevel也就是低于IE5。0的版本
条件表达式的运算符:
IE | [if IE] | The only currently supported feature is the string "IE", corresponding to Internet Explorer.也就是只支持IE |
value | [if IE 7] | An integer or floating point numeral corresponding to the version of the browser. Returns a Boolean value of true if the version number matches the browser version. For more information, see Version Vectors 可以是一个整数或者是一个浮点数,用来表明版本号 |
! | [if !IE] | The NOT operator. This is placed immediately in front of the feature, operator, or subexpression to reverse the Boolean meaning of the expression. 取反元算符 |
lt | [if lt IE 5.5] | The less-than operator. Returns true if the first argument is less than the second argument. 小于运算符 |
lte | [if lte IE 6] | The less-than or equal operator. Returns true if the first argument is less than or equal to the second argument. 小于或等于运算符 |
gt | [if gt IE 5] | The greater-than operator. Returns true if the first argument is greater than the second argument. 大于运算符 |
gte | [if gte IE 7] | The greater-than or equal operator. Returns true if the first argument is greater than or equal to the second argument. 大于或等于运算符 |
( ) | [if !(IE 7)] | Subexpression operators. Used in conjunction with boolean operators to create more complex expressions. 就是括弧 |
& | [if (gt IE 5)&(lt IE 7)] | The AND operator. Returns true if all subexpressions evaluate to true 与运算符 |
| | [if (IE 6)|(IE 7)] | The OR operator. Returns true if any of the subexpressions evaluates to true. 或运算符 |
true | [if true] | Always evaluates to true. 布尔值 |
false | [if false] | Always evaluates to false. 布尔值 |
<!--[if IE 7]>--> <h1>jkfjk</h1> <!--<![endif]-->
<!--[if IE 7]><!--> <h1>jkfjk</h1> <!--<![endif]-->
上面的代码你在IE浏览器中使用就会发现有区别了,IE的解决方法就是在前一个的前面加上了"<!"。
还有一个就是IE的版本号在小数点后又四位数,5.0453是正确的,5.0.4.5.3是错误的。但是随win2000发布的IE版本号是5.0002,只这一个特例。 呵呵,英语水平有限,有不对的地方还请指点,希望各位高手给这个板块加点人气。
本文来自: CSSPLAY中文官方网(http://www.cssplay.org.cn/) 详细出处参考:http://www.cssplay.org.cn/css-hack/20080227/96.html
相关文章推荐
- 代码规范 : 关于注释和日志
- 关于写代码的注意事项之,全部英文注释,tab缩进换成四个空格的缩进,代码末尾不能有空格
- 关于代码注释
- 关于PowerDesign让生成的代码成功的为字段生成注释
- CSS条件注释:针对浏览器版本不同而选择不同CSS的代码
- 2014.12.1《Clean Code-代码整洁之道》的阅读感悟 - 关于代码注释的实际使用及体会
- 关于CSS Hack与float闭合的CSS技巧 清除浮动代码
- CSS注释代码
- 关于Javsript代码的注释和模块定义
- HTML,CSS,JS,ASP等代码注释方法
- 关于代码中写注释,你不得不知道的那些事儿
- 关于Java中的注释语句的对Java代码的影响
- CSS注释代码
- css 简单 返回顶部 代码及注释说明
- 阅读笔记 > 关于代码注释
- com.css.common.upload.servlet关于文件上传的代码
- 自说明代码:关于注释的一点事儿
- 关于java代码中的注释问题。(类中方法的注释,我们一般都要写上这个方法的文档(doc),方法的参数也要有它的文档)
- 详解CSS的Sass框架中代码注释的编写方法
- 关于代码中空白、注释等字符的统计(正则表达式的使用)