JQuery User Manual (iii) _ jquery

Source: Internet
Author: User
JQuery user manual. You can read it patiently and get started. 3. :CSS operations

Traditional javascript has complicated operations on css, such

Css

The background syntax is document. getElementById (""). style. background, while jQuery is more convenient for css operations, $ ("# "). background (), $ ("# "). background ("red ")
$ ("# A") Get the jQuery object [

]
$ ("# A"). background () will retrieve the background style of the object.
$ ("# A"). background ("red") sets the background style of this object to redJQuery provides the following methods to operate css
Background () background (val) color (val) css (name) css (prop)
Css (key, value) float (val) height (val) width (val)
Left () left (val) overflow (val) position (val) top (val)


Here we need to explain the css (name) css (prop) css (key, value). What do other users know about the functions of their names!<PId= ""Style= "Background: blue; color: red">Css P> <PId= "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 the blue

Css (prop)Prop is a hash object used to set a large number of css styles.
$ ("# B" ).css ({color: "red", background: "blue "});
The final result is

Test

, {Color: "red", background: "blue"}, hash object, color as key, and "red" as value,

Css (key, value)Used to set a separate css style
$ ("# B" ).css ("color", "red"); the final effect is

Test

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.