When use H1, H2, H3, H4, H5 tags? [closed]

What is the standard practices for this scenario?

Using the tags isn’t about presentation, it’s about semantics. If you use the various h1, h2, etc. tags, you’re giving information about the meaning of the content of the text within them. This gives anything reading your document information about the document’s structure and meaning. There’s a section about the semantics of headings and sections in the spec.

The following markup tells software reading it that the text “Web Semantics” is a heading for content in the document, and therefore that the following paragraphs likely relate to web semantics:

<h1>Web Semantics</h1>
<p>Blah blah blah blah</p>

In contrast, if you have this:

<div>Web Semantics</div>
<p>Blah blah blah blah</p>

then even if the div is styled to look just like an h1, there’s no information in your document about the meaning of the text “web semantics” (in the context of your document).

This matters for content extraction, including the ever-popular SEO.

Leave a Comment