Module 6 - Lesson 8

Changing Element CSS with jQuery

In this lesson, I’ll explain how jQuery connects with your CSS and how you can use it to modify the CSS code and the appearance of your content. We’ll get familiar with the css() method syntax and methods for changing an element’s CSS classes: addClass(), removeClass() and toggleClass();

Video Chapters

00:00 Introduction

01:47 CSS method syntax (single property)

03:17 Syntax for multiple properties

06:15 Relative sizing

07:44 addClass method

09:05 removeClass method

10:21 toggleClass method

Modifying single CSS property:

$('element').css('border','2px solid #000');

Modifying multiple CSS properties:

$('element').css({
	'border' : '2px solid #000',
	'bacgkround-color' : '#fff',
	'font-size' : '20px'
});

Join the discussion

Share your thoughts about this lesson with fellow students!

Login to your Account

If you're a DSA Student, please log in to your account to access the course content.

Sorry, you don't have access to this content.

It looks like you're not enrolled in Divi Stylist Academy.