jQuery css() Method

Get/Set CSS properties.

jQuery css() Method

The css() method sets or returns one or more style properties for the selected elements.

Return CSS Property

To return the value of a specified CSS property, use the following syntax:

css("propertyname");

Set CSS Property

To set a specified CSS property, use the following syntax:

css("propertyname", "value");

Example

$("p").css("background-color");