hgroup
The historical <hgroup> element was proposed to group a heading with a subtitle or alternate title. It is not part of current HTML, so new documents should use ordinary headings and supporting text.
What you will learn
- What
hgroupwas intended to group - Why current HTML documents should avoid it
- How to structure a heading and supporting text safely
Historical syntax
<!-- Historical example: do not use for new work. -->
<hgroup>
<h1>Web design</h1>
<p>A practical introduction</p>
</hgroup>
Different versions of the proposal treated the supporting content differently, and browser and accessibility support was inconsistent. Avoid relying on it to create a special heading hierarchy.
Use a heading and supporting text
<header>
<h1>Web design</h1>
<p class="subtitle">A practical introduction</p>
</header>
Use one heading for the section's title, then use a paragraph for a subtitle or explanation. Style the paragraph with CSS. If the supporting text is itself a separate topic, give it the appropriate heading level instead.
Keep the heading outline meaningful
Choose heading levels according to the document hierarchy, not the font size you want. Do not skip levels just to make a subtitle look smaller or larger; use CSS for appearance.