Jquery CSS operations
Jquery has three important functions for CSS operations:
- ((Selector).css (name, value)
- Detail (selector).css ({properties })
- ((Selector).css (name)
CSS operation instance
The function CSS (name, value) sets the value for the given CSS attribute of all matching elements:
Instance
((Selector).css (name, value)
$ ("P" ).css ("background-color", "Red ");
Function CSS ({properties}) simultaneously sets values for a series of CSS attributes of all matching elements:
Instance
Detail (selector).css ({properties })
$ ("P" ).css ({"background-color": "red", "font-size": "200% "});
The function CSS (name) returns the value of the specified CSS attribute:
Instance
((Selector).css (name)
Background (this).css ("background-color ");
Jquery size operation
Jquery has two important functions for dimensional operations:
- $ (Selector). Height (value)
- $ (Selector). Width (value)
Jquery CSS operation functions
The methods listed below set or return CSS-related attributes of elements.
| CSS attributes |
Description |
| CSS () |
Set or return the style attribute of the matching element. |
| Height () |
Sets or returns the height of the matching element. |
| Offset () |
Returns the position of the First Matching Element relative to the document. |
| Offsetparent () |
Returns the nearest ancestor element. |
| Position () |
Returns the position of the First Matching Element relative to the parent element. |
| Scrollleft () |
Sets or returns the offset of the matching element relative to the top of the scroll bar. |
| Scrolltop () |
Sets or returns the offset of the matching element to the left of the scroll bar. |
| Width () |
Set or return the width of the matching element. |