HTML Classes

The HTML class attribute makes it possible to define same styles for elements with the same class name.

We will see how to apply this to both block elements and inline elements.

Classes in block elements:

Here we have <div> elements that points to the same class name. Example:

Thus we get,

adding class

  Class Attribute on Inline Elements

Important Heading

This is some confidential text.

PS: For any questions, queries, feedback, and comments feel free to write us at and

Amruta Somani

About the Author

Amruta Somani