Sometimes, we want to inherit CSS classes.
In this article, we’ll look at how to inherit CSS classes.
How to inherit CSS classes?
To inherit CSS classes, we add multiple classes to an element.
For instance, we write
<div class="classOne classTwo">
<p>I'm bold and verdana.</p>
</div>
to add classOne and classTwo to the div.
Then we write
.classOne {
font-weight: bold;
}
.classTwo {
font-famiy: verdana;
}
to add the styles for classOne and classTwo.
The styles for both classes will be applied to the div.
Conclusion
To inherit CSS classes, we add multiple classes to an element.