An example of setting CSS properties in jQuery


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%"});