<?xml version="1.0" encoding="utf-8"?>

One element can have multiple classes

One element can have multiple classes Bad Practice
One element can have multiple classes Best Practice

One of the benefits of using classes is that one element can belong to more than one class. To list classes, write them within the class attribute value separated by single spaces.

Let's say you have a page with a selection of products. You want all your prices to be displayed in blue and for discounted prices to be displayed in a light grayish cyan background. Set the class attribute value of a discounted price to "price best", and add the following CSS rules:

.price {

color:blue;

}

.best {

background-color:#e1f6ee;

}

Improve your UX & Product skills with interactive courses that actually work