jQuery – Set CSS Properties

The css() method is used in jQuery to set the CSS properties. In the below example, we will set the color property for the <h2> element. The font color property will be set to red for the <h2> element:

Output

jQuery Set CSS Property

Set Multiple CSS Properties

To set more than one CSS property, use the same css() method, and that too only once. In the below example, we will set 3 properties for the <h1> elements. Let us see the example:

Output

jQuery Set Multiple CSS Properties

jQuery - Get CSS Properties
jQuery - Hide an element
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading