In HTML 5, the h1 tag defines a header. In fact, HTML 5, like its predecessors, has six headings, from h1 to h6.
When Do You Use the h1 Tag in HTML 5?
In HTML 5, the header tags are hierarchical. That is, h1 is a higher level tag than h2, which is higher than h3, etc. They form a nested hierarchy of importance. It’s important that with each level of heading, that the next heading further explain or break down the topic contained in the heading above it. If it does not, consider using an equal-level heading, or if the topic is different entirely, consider a higher level tag. Think of it as a High School English project where your teacher asks you to outline the main topics in a short article, and you’ll get the idea.
By the way, it’s a rare (and long) website page that will use all heading tags. It is possible, though. Short articles such as this are lucky if they get two the h2 tag.
To rank well with search engines, most experts (myself included) will tell you to choose the words for your h1 tag well, because, aside from the title tag, this is probably the second-most important tag on your page. I would also recommend you only put one h1 tag on the page, that being the main heading. If you feel the need for more than one, take that as a sign that you need to break up your topic onto multiple pages.
Any words for which you want to be found in search engines should be in your h1 tag. But please, be concise, precise, and meaningful. Don’t jam this tag full of meaningless words in a jumbled, long phrase. That’s a great way to get banned from the search engines.
How Is the h1 Tag Used in HTML 5 Documents?
Here is a simple example:
<h1>This is the main heading of this page</h1>
<p>This is a paragraph introducing the topic.</p>
<h2>Here is a second-level heading in the page hierarchy.</h2>
<p>And here is another paragraph explaining this sub-topic.</p>
