2019-10-19
Heading class trick
There can be cases where you need an h2
to have the same style as h1
.
The solution that I use for this is by using classes.
h1,
.h1 {
font-size: 2rem;
}
<h1>Heading 1</h1>
<h2 class="h1"></h2>
With this solution you can prevent duplicated code. It's also very easy to remember because the class name is the same as the element name.
Comments