Sometimes, we want to semantically add a heading to a list with HTML.
In this article, we’ll look at how to semantically add a heading to a list with HTML.
How to semantically add a heading to a list with HTML?
To semantically add a heading to a list with HTML, we add it above the list.
For instance, we write
<h2>About Fruits</h2>
<section>
<h3>Fruits I Like:</h3>
<ul>
<li>Apples</li>
<li>Bananas</li>
<li>Oranges</li>
</ul>
</section>
to add the h3 element above the ul element to add the heading.
Conclusion
To semantically add a heading to a list with HTML, we add it above the list.