读书人

js操作css的规约

发布时间: 2012-11-23 22:54:33 作者: rapoo

js操作css的规则

书写规则:

?

1、没有中划线的css属性,直接使用“style.属性名”即可。
如:obj.style.width,obj.style.left等。

?

2、含有中划线的css属性,去掉中划线并将中划线后的那个字符大写即可。
如:obj.style.zIndex,obj.style.fontFamily等。

?

3、特殊属性:float,不能直接使用obj.style.float,这样操作是无效的。正确的使用方法是:IE:obj.style.styleFloat,其他浏览器:obj.style.cssFloat。

读书人网 >CSS

热点推荐