In the above example, we have used css method to change the color of text. We have applied single css property, similarly we can set more than one. Example 2 : .css() with multiple properties We can also set multiple properties using css() method. We use different syntax to set multiple properties.

In the above example, we have set multiple css properties using the same css() method. We can also use variable to set the css properties. We can assign all to properties to set to a variable and then use that variable as a parameter to css() method. We have demonstrated the use of variable in following example.Example 3 : css() using variableWe can assign all the css properties to a variable and can use this variable to set the css. This approach will save our time from writing the same css properties again and again.

In the above example, we have assign all the css properties to a variable and used the same variable to apply the CSS.Example 4 : addClass()We can also use addClass() method to apply css. We can create a CSS class with all properties defined with values and we can use addClass() method to apply the CSS class.