Clarity and Structure with Classes

In addition to the ID attribute, another attribute that is valid in every HTML element is the class attribute.

stacked building blocks with similar class names

Like the ID attribute, the class attribute is an identifier and selector value for HTML elements. The class attribute groups similar types of elements together by using the same unique name value. This allows for easy styling of these elements with same CSS code.

HTML
<div id="a-unique-id" class="a-unique-class-name">

The class attribute also serves to visually inform developers that certain elements content similar types of content, or serve a similar function on a page.