<hgroup> groups one heading with secondary text such as a subtitle or tagline. Modern HTML permits one <h1>–<h6> heading with paragraphs before or after it. It is not a deprecated container for several heading ranks.
A heading and a subtitle
The subtitle is a paragraph because it does not introduce another section. Only the <h1> contributes a heading to the outline.
HTML and CSS
HTML
<hgroup>
<h1>Small spaces, useful gardens</h1>
<p>A practical guide to growing herbs on a balcony</p>
</hgroup>
<p>Start with containers that drain and a spot that receives enough light.</p>
CSS
hgroup p {
color: #475569;
}
Edit HTML or CSS to update the preview as you type. Copy code snippet copies the selected tab. Preview spacing and font defaults are not included.
Content and accessibility
Use exactly one heading, with optional <p> elements around it and permitted script-supporting content. Do not use several headings solely to get different font sizes. The group does not create a new heading level or alter the heading’s rank.
Inspect the example’s heading navigation: there is one heading, while the subtitle remains readable text. A simple heading followed by a paragraph is also a valid way to present a subtitle when you do not need the grouping element.
Historical examples
Older material may show <hgroup><h1>…</h1><h2>…</h2></hgroup> or call the element obsolete. That is not the current content model. Use a section with a properly ranked heading for a real subsection.
Sources and browser support
MDN: hgroup describes the syntax and links to the specification and compatibility data. Check individual values in that table when supporting older browsers.