好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

javascritp操作css_html/css_WEB-ITnose

CSS

Javascript动态操作CSS总结

http://sweetpoem.iteye测试数据/blog/1099825

一、使用js操作css属性的写法

1、对于没有中划线的css属性一般直接使用style.属性名即可。
如:obj.style.margin,obj.style.width,obj.style.left,obj.style.position
2、对于含有中划线的css属性,将每个中划线去掉并将每个中划线后的第一个字符换成大写即可。
如:obj.style.marginTop,obj.style.borderLeftWidth,obj.style.zIndex,obj.style.fontFamily等
3、js操作css float属性的特殊写法
因为 float 是javascript的保留字,我们不能直接使用obj.style.float来使用,这样操作是无效的。其正确的使用方法是为:IE:obj.style.styleFloat,其他浏览器Mozilla(gecko),ff等用 styleFloat:obj.style.cssFloat。

二、使用js获取css属性值

1、获取行内Style:obj.style. 属性名。

JS获取CSS属性值

查看更多关于javascritp操作css_html/css_WEB-ITnose的详细内容...

  阅读:36次