HTML & CSS - - By Craig Buckler

RIP HTML5 <hgroup> Element

Do you use the hgroup element in your mark-up? It’s probably best not to — the tag is being dropped from the HTML5 specification.

We normally think of HTML5 specifications receiving additional features, such as the new <main> element. However, elements can be removed if they offer no compelling benefits.

hgroup represented the heading of a section and normally contained two or more h1 to h6 child elements, e.g.

<hgroup>
<h1>My Main Heading</h1>
<h2>A sub-heading</h2>
</hgroup>

Did you ever use it? I can recall one occasion and, even then, it was primarily for use as a CSS hook and could have easily been a div or section. The request to remove it came from Steve Faulkner:

  • hgroup does not convey clearly that a particular heading is a sub-heading
  • heading semantics are still exposed regardless of an outer hgroup
  • the specification stated all hgroup headings must be concatenated for accessibility, i.e. the title would become “My Main Heading A sub-heading”
  • hgroup did not have at least two reasonably complete interoperable implementations, i.e. it was a div by another name
  • few sites implement the hgroup element

No reasonable use-cases were forthcoming so hgroup will ultimately disappear from the HTML5 specification. There is a possibility it will morph into another element offering better semantics, but those debates are yet to occur.

No … I Use hgroup On Every Page!

The removal of hgroup will make little difference to your daily coding efforts. Most browsers already support it and, even in a new applications, hgroup would be treated the same as any unknown tag. That said, it’s probably best to avoid using hgroup in new projects since HTML validators will eventually report an error.

Sponsors