To assign multiple classes to an HTML container, you can simply list the class names in the class
attribute, separating each class name with a space.
Example:
In this example, the div
element has three classes: class1
, class2
, and class3
.
Adding Classes Dynamically with JavaScript:
If you want to add or remove classes dynamically using JavaScript: