The HTML class attribute is a global attribute used to specify one or more class names on an HTML element.
Definition and Usage
➔ The primary use of the class attribute is to apply styles defined in CSS stylesheets.
➔ In CSS, class selectors are preceded by a dot (.)
➔ The class attribute allows JavaScript to select and manipulate specific HTML elements.
➔ Class names are case-sensitive.
➔ As a global attribute, the class attribute can be applied to any HTML element.
Applies to
This attribute can be used on the following element.
| Attribute | Element |
|---|---|
| class | Global Attributes |