Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Web Browser

Code Editor

Up to this point, we've used CSS to select an HTML element by its tag name only. However, we can use class selectors to target classes of HTML elements.

Consider the HTML below:

<div class="header"> <h2>Heading</h2> <p>Paragraph</p> </div>

Here, the div is the parent element and the h2 and p are children. CSS styles applied to the header class selector will automatically apply to the h2 and the p.

Here's a refresher on parent and child elements.

In CSS, class selectors can be identified by a dot . followed by the class name, as seen below:

.header { color: #ffffff; }

As a result of this code, child elements of divs with the header class will have a font color of #ffffff (white).

Below, we will use a CSS class selector to style more than one HTML element at once.

Report a Bug
If you see a bug or any other issue with this page, please report it here.