The properties and styles of jquery manipulate the style. CSS ()

Source: Internet
Author: User

. CSS () method: Gets the calculated value of the element style property or sets the CSS property of the element

Get:

    1. . CSS (PropertyName) : Gets the computed value of the style property of the first element in the matching element collection
    2. . CSS (propertynames): Passing a set of arrays, returning an object result

Set up:

    1. . CSS (propertyname, value): Set CSS
    2. . CSS (propertyname, function): You can pass in a callback function and return to the corresponding value for processing
    3. . CSS (properties): You can pass an object and set multiple styles at the same time

Precautions:

    1. Browser properties are obtained in different ways, when you get some values, jquery uses a unified processing, such as color using RBG, size using px
    2. The. css () method supports the writing of camel-hump and case-mix, and the internal fault-tolerant processing
    3. When a number is only used as a value, jquery converts it to a string and adds PX at the end of the string, such as. css ("width", 50}) as with. CSS ("width", "50px"})
    4. The . AddClass () method is done by adding the class name, so the style is defined in the external file or internal style, and is appended to the element when needed through
    5. The. css () method handles inline styles, which are attached directly to the element through the style property of the element (the style attributes that are set by the. CSS method are prioritized higher than the. AddClass method)

The properties and styles of jquery manipulate the style. CSS ()

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.