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

The class attribute

The class attribute Bad Practice
The class attribute Best Practice

Besides giving unique ids to the elements, you can also assign classes. Unlike ids, many elements can belong to the same class, and one element can have many classes. If we go back to the analogy about ids being similar to names in their uniqueness, classes are more like groups people belong to. For example, you might know only one Chris Hemsworth, but many people have the same gender and same citizenship — being male and Australian are two of the groups he belongs to. class is a global attribute, meaning that it can be added to any element.

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