View Full Version : Is it okay to nest H1 in Anchors?

08-19-2010, 09:50 PM
<a href="/home"><h1>My Title</h1></a>

S'ok? Or bad juujuu?

08-19-2010, 10:36 PM
<h1><a href="/home">My Title</a></h1>

semantically you should not put block elements inside inline ones

H1 = block
anchor = inline

08-20-2010, 11:30 AM
No, it’s not OK as it will result in invalid HTML. As said already you can’t put block elements inside inline elements, only vice versa. Therefore, you need to put the anchor inside the h1, not the h1 inside the anchor.

<h1><a href="/home">My Title</a></h1>

12-31-2010, 12:29 AM
Sorry to bring this up again.

Has this rule been relaxed in HTML5? For instance, on the Apple store page, in the central content area towards the middle of the page, there are h3 tags that are nested in anchor tags. Search in the source code, for instance, for
<h3>iPod touch</h3>. When I try to validate this page, those particular tags don't come up as invalid. Any thoughts on this?

Best Regards,