← 4.4.6 The h1, h2, h3, h4, h5, and h6 elementsTable of contents4.4.8 The header element →

4.4.7 The hgroup element

Flow content.
Heading content.
Palpable content.
Contexts in which this element can be used:
Where flow content is expected.
Content model:
One or more h1, h2, h3, h4, h5, and/or h6 elements.
Content attributes:
Global attributes
DOM interface:
Uses HTMLElement.

The hgroup element represents the heading of a section. The element is used to group a set of h1h6 elements when the heading has multiple levels, such as subheadings, alternative titles, or taglines.

Other elements of heading content in the hgroup element indicate subheadings or subtitles.

The rank of an hgroup element is the rank of the highest-ranked h1h6 element descendant of the hgroup element, if there are any such elements, or otherwise the same as for an h1 element (the highest rank).

The section on headings and sections defines how hgroup elements are assigned to individual sections.

Here are some examples of valid headings.

 <h1>The reality dysfunction</h1>
 <h2>Space is not the only void</h2>
 <h1>Dr. Strangelove</h1>
 <h2>Or: How I Learned to Stop Worrying and Love the Bomb</h2>

The point of using hgroup in these examples is to mask the h2 element (which acts as a secondary title) from the outline algorithm.

How a user agent exposes such multi-level headings in user interfaces (e.g. in tables of contents or search results) is left open to implementors, as it is a user interface issue. The first example above could be rendered as:

The reality dysfunction: Space is not the only void

Alternatively, it could look like this:

The reality dysfunction (Space is not the only void)

In interfaces where a title can be rendered on multiple lines, it could be rendered as follows, maybe with the first line in a bigger font size:

The reality dysfunction
Space is not the only void