Reputation: 4987
If a header section contains only heading (eg. h1, h2..), and no other information. Should it still be wrapped it in the header tags? Or the header tags should be used if it has more content than just the headings?
For example, should this be used?
<section>
<h2> .... </h2>
<div>
...
</div>
</section>
or this?
<section>
<header>
<h2>...</h2>
</header>
<div>
...
</div>
</section>
Upvotes: 0
Views: 530
Reputation: 4072
Here's that HTML5 doctor article:
Avoiding common HTML5 mistakes
...as linked to by @simoncereska.
To save folks some time, here's the relevant quote:
If your
<header>
element only contains a single heading element, leave out the<header>
. The<article>
(for example) ensures that the heading will be shown in the document outline, and because the<header>
doesn’t contain multiple elements (as the definition describes), why write code when you don't need to? Simply use this:<article> <h1>My best blog post</h1> <!-- Article content --> </article>
The article is definitely worth reading, but if your looking for a quick answer, then see the bold text in the above quote. :)
Upvotes: 1