. CSS () method: Gets the calculated value of the element style property or sets the CSS property of the element
Get:
- . CSS (PropertyName) : Gets the computed value of the style property of the first element in the matching element collection
- . CSS (propertynames): Passing a set of arrays, returning an object result
Set up:
- . CSS (propertyname, value): Set CSS
- . CSS (propertyname, function): You can pass in a callback function and return to the corresponding value for processing
- . CSS (properties): You can pass an object and set multiple styles at the same time
Precautions:
- 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
- The. css () method supports the writing of camel-hump and case-mix, and the internal fault-tolerant processing
- 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"})
- 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
- 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 ()