hgroup
element
h1
,
h2
,
h3
,
h4
,
h5
, and/or
h6
elements.HTMLElement
.The hgroup
element represents
the heading of a section. The element is used to group a set of
h1
–h6
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
h1
–h6
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.
<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.
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