How to use The class Attribute in HTML?
The class attribute specifies one or more class names for an HTML element.
Do you have similar website/ Product?
Show in this page just for only
$2 (for a month)
0/60
0/180
The class name can be used by CSS and JavaScript to perform certain tasks for elements with the specified class name.
HTML elements can have more than one class name each class name must be separated by a space.
To select elements in CSS with a specific class write a period (.) character followed by the name of the class.
E.g:
class AttributeUse CSS to style elements with the class name "name": JohnJohn is a Doctor. MichelMichel is a Lawyer. |
class Attribute in JavaScript
JavaScript can access elements with a specified class name by using the getElementsByClassName() method.
E.g:
|