: For a page that lists multiple blog posts, is it acceptable for each post to use an tag? Posts page has multiple <h1> tags (one for every post). There are almost no <h2> tags
Posts page has multiple <h1> tags (one for every post). There are almost no <h2> tags on the page.
Do you think it's fine to have multiple <h1> tags if each of those tags have equal importance?
More posts by @Pierce454
2 Comments
Sorted by latest first Latest Oldest Best
If you have multiple blog posts (whether with full text or just teasers) on a page, each post should get its own article element.
The first heading element (h1-h6) in the article (and not nested in another sectioning content element) will be that article’s heading.
HTML 5.1 allows authors to use h1 all the time, but it recommends that authors use
[…] headings of the appropriate rank for the section’s nesting level.
The following snippets show what is recommended:
<body>
<article>
<h2></h2>
<!--
<h2> because the <article> is on the second level
(<body> being the first one)
-->
</article>
<article>
<h2></h2>
</article>
</body>
<body>
<section>
<article>
<h3></h3>
<!--
<h3> because the <article> is on the third level
(<body> being the first one, <section> being the second one)
-->
</article>
<article>
<h3></h3>
</article>
</section>
</body>
<body>
<div>
<article>
<h2></h2>
<!--
<h2> because the <article> is on the second level
(<body> being the first one);
as <div> is not a sectioning content element,
it doesn’t represent a nesting level for the outline
-->
</article>
<article>
<h2></h2>
</article>
</div>
</body>
But in those three examples, it would be valid to use h1 (or any other heading element) instead.
The answer is no. There should be only one <h1> element on a page. And, interestingly enough, there was an article that came out just today about this as far as use with <section>.
In any case, browsers still treat <h1> as the heading for the whole page.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.