]
$("#a").background() will take out the background style of the object.
$("#a").background("red") sets the background style of the object to red
jQuery provides the following methods to operate css
background () background (val) color() color(val) css(name) css(prop)
css(key, value) float() float(val) height() height(val) width() width( val)
left() left(val) overflow() overflow(val) position() position(val) top() top(val)
Need to explain css here (name) css(prop) css(key, value), you will know what the other ones do just by looking at their names!
<div id="a" style="background:blue ; color:red">cssdiv><P id="b">test P>
css(name) Get the style named name
$("#a" ).css("color") will get the color value red in the style, ("#a").css("background ") will get blue
css(prop) prop is a hash object, used to set a large number of css styles
$("#b").css({ color: "red", background: "blue" });
Final effect It istest
,{ color: "red", background: "blue" }, hash object, color is the key, " red" is value,
css(key, value) is used to set a separate css style
$("#b").css( "color","red");The final effect istest
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