HTML elements have the ability to be associated with multiple classes.
To designate multiple classes, delineate the class names with spaces, for instance, <div class=”city main”>. Consequently, the element will be styled according to the rules defined in all specified classes.
In the given example, the initial <h2> element is assigned both the city and main classes, thus inheriting CSS styles from both classes.
Example
<h2 class=”city main”>London</h2> <h2 class=”city”>Paris</h2> <h2 class=”city”>Tokyo</h2> |