How To Change or Restore Your CSS Using jQuery

0
78

Change or Restore Your CSS Using jQuery

This Article Is About Change or Restore Your CSS Using jQuery The jQuery .css() method is an easy way to change the CSS of any HTML element, class, or ID without actually having to edit any of your stylesheets.

If you’re using the .css() method to only add one new style rule to your HTML, the syntax should be like this:

$(“element”).css(“property name”, “property value”);

If you’re trying to change the styling of more to one element, the syntax will differ slightly:

$(“element”).css({“property name”:”property value”, “property name”:”property value”, “property name”:”property value”});

In the example below, let’s change the font-size and color of this header tag:

Screen Shot 2016-08-25 at 10.59.08 AM

Here’s the code:

LEAVE A REPLY

Please enter your comment!
Please enter your name here