I was checking the article 20+ Professional Examples of Websites Using HTML5 to see the good semantic uses of new HTML 5 tags and I found that this website http://bit.ly/bfgatc is using H2
before H1
in Header.
Is it ok in HTML5?
I was checking the article 20+ Professional Examples of Websites Using HTML5 to see the good semantic uses of new HTML 5 tags and I found that this website http://bit.ly/bfgatc is using H2
before H1
in Header.
Is it ok in HTML5?
In my opinion, neither of those have any business being separate headers, and they definitely shouldn't be in an <hgroup>
. They're one header, and should be inside a <header>
, or maybe even in a <section>
. They don't have separate levels; one's just styled bigger than the other. It's not semantically correct to use the two in either order.
So what I would recommend is, instead of:
<header>
<nav>...</nav>
<div>
<hgroup>
<h2>...</h2>
<h1>...</h1>
</hgroup>
</div>
</header>
would be:
<nav>...</nav>
<header>
<h1>I design user interfaces and strive for <strong>perfection.</strong></h1>
</header>
<h1>
.
<strong>
, and it's also much cleaner.
The element has been removed from the HTML5 (W3C) specification. As Ryan said. It would be better to put it in a tag.
Why not? The spec for hgroup
says:
The hgroup element is typically used to group a set of one or more h1-h6 elements — to group, for example, a section title and an accompanying subtitle.
It seems to clear to me that a section title would be a H1 for example, and the subtitle a H2.
To expand: In this situation, it doesn't really make sense, but in general, there is technically nothing wrong with this (although a bit weird).
hgroup
inheader
and there is only onh1
andh2
insidehgroup
so all ids are unnecessary.