jQuery使用手册之CSS操作

from :http://www.ijavascript.cn/jquery/jquery-manual-css-50.html

Jquery对css的操作相当方便,能很方便我们去通过js修改css。传统javascript对css的操作相当繁琐,比如

css

取它的background语法是:

document.getElementById(“a”).style.background

而jQuery对css更方便的操作:

$(“#a”).background();$(“#a”).background(“red”)

说明如下
$(“#a”)得到jQuery对象[

] $(“#a”).background()将取出该对象的background样式。 $(“#a”).background(“red”)将该对象的background样式设为redjQuery提供了以下方法,来操作css: - background () - background (val) - color() - color(val) - css(name) - css(prop) - css(key, value) - float() - float(val) - height() - height(val) - width() - width(val)