WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

jQuery - css() Method


jQuery css() Method

The css() strategy sets or returns at least one style properties for the chose elements.



Return a CSS Property

To return the estimation of a predetermined CSS property, utilize the accompanying syntax:

css("propertyname");

The following model will restore the foundation shading estimation of the FIRST coordinated element:

Example

$("p").css("background-color");
Try it yourself »

Set a CSS Property

To set a predetermined CSS property, utilize the accompanying syntax:

css("propertyname","value");

The following model will set the foundation shading an incentive for ALL coordinated elements:

Example

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

Set Multiple CSS Properties

To set various CSS properties, utilize the accompanying syntax:

css({"propertyname":"value","propertyname":"value",...});

The following precedent will set a foundation shading and a text dimension for ALL coordinated elements:

Example

$("p").css({"background-color": "yellow", "font-size": "200%"});