JQuery CSS of method examples
- 2020-03-30 01:24:56
- OfStack
The CSS () method sets or returns one or more style attributes of the selected element.
Set CSS properties
To set the specified CSS properties, use the following syntax:
The following example sets background-color values for all matched elements:
The instance
Set multiple CSS properties
To set multiple CSS properties, use the following syntax:
The following example sets background-color and font-size for all matched elements:
The instance
Set CSS properties
To set the specified CSS properties, use the following syntax:
css("propertyname","value");
The following example sets background-color values for all matched elements:
The instance
$("p").css("background-color","yellow");
Set multiple CSS properties
To set multiple CSS properties, use the following syntax:
css({"propertyname":"value","propertyname":"value",...});
The following example sets background-color and font-size for all matched elements:
The instance
$("p").css({"background-color":"yellow","font-size":"200%"});