I have never used that element, I don’t even remember seeing it used.
As said, it is used to group the heading element with related content using p
elements instead of using other heading elements that would change the document outline.
The element may be used to group an h1–h6
element with one or more p
elements containing content representing a subheading, alternative title, or tagline.
Its usage and meaning also seem to have changed. At one point, it (apparently) allowed multiple heading elements and was used to “mask” other heading elements.
4.4.7 The hgroup element — HTML5: Edition for Web Authors
Here are some examples of valid headings. In each case, the emphasized text represents the text that would be used as the heading in an application extracting heading data and ignoring subheadings.
<hgroup>
<h1>**The reality dysfunction**</h1>
<h2>Space is not the only void</h2>
</hgroup>
<hgroup>
<h1>**Dr. Strangelove**</h1>
<h2>Or: How I Learned to Stop Worrying and Love the Bomb</h2>
</hgroup>
The point of using hgroup
in these examples is to mask the h2
element (which acts as a secondary title) from the outline algorithm.
That is now invalid HTML.
Here is something from the current specs.
3.2.1 Semantics
For example, the following snippet, intended to represent the heading of a corporate site, is non-conforming because the second line is not intended to be a heading of a subsection, but merely a subheading or subtitle (a subordinate heading for the same section).
<body>
<h1>ACME Corporation</h1>
<h2>The leaders in arbitrary fast delivery since 1920</h2>
...
The hgroup
element can be used for these kinds of situations:
<body>
<hgroup>
<h1>ACME Corporation</h1>
<p>The leaders in arbitrary fast delivery since 1920</p>
</hgroup>
...