jQuery operates CSS
- addClass() - Add one or more classes to the selected element
- removeClass() - removes one or more classes from selected elements
- toggleClass() - Add/remove classes to the selected element.
- css() - Sets or returns one or more style attributes of the selected element.
jQuery css() method
〈1〉Return CSS properties
css("propertyname");
Copy after login
〈2〉Set CSS properties
css("propertyname","value");
Copy after login
〈2.1〉Set multiple CSS properties
css({"propertyname":"value","propertyname":"value",...});
Copy after login
jQuery size method
jQuery provides several important methods for handling dimensions:
- width() Sets or returns the width of an element (not including padding, borders, or margins).
- height() Sets or returns the height of an element (not including padding, border, or margins).
设置:$("#div1").width(500).height(500); more : $(window/document).width/height;
Copy after login
- innerWidth() Returns the width of the element (including padding).
- innerHeight() Returns the height of the element (including padding).
- outerWidth() Returns the width of the element (including padding, border and margin).
- outerHeight() Returns the height of the element (including padding, border and margin).