HTML <hgroup> Tag

The <hgroup> element represents a heading and related content. It groups a single <h1>–<h6> with one or more <p> elements for a subtitle, alternative title, or tagline.

<hgroup> itself does not change the document outline. Only the heading inside it contributes to the outline.

Baseline · Widely available.

Stable across browsers since about July 2015. Use it when a heading and its tagline belong together.

Content model.

Zero or more <p>s, then one heading, then zero or more <p>s. Do not nest multiple headings.

HTML Syntax

syntax.html
<hgroup> <h1>…</h1> <p>…</p></hgroup>

Both start and end tags are required. Style the group with CSS; the tag only groups the meaning.

Attributes

<hgroup> has no element-specific attributes. Use global attributes:

AttributeDescriptionTry it
(none specific)No tag-only attributes — meaning comes from grouping heading + <p>Try it
idAnchor target for the whole heading groupTry it
classHooks for styling title + tagline togetherTry it

Global Attributes

The <hgroup> tag also supports the Global Attributes in HTML.

Live Preview

Switch common <hgroup> patterns for titles and taglines.

A real <hgroup>. Pick a pattern, then Apply (or tap a chip).

Preview

Frankenstein

Or: The Modern Prometheus

Title + subtitle · one h1, one p

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Title with Subtitle

Group a main title and an alternate or subtitle line.

HTML
<hgroup>
  <h1>Frankenstein</h1>
  <p>Or: The Modern Prometheus</p>
</hgroup>
<p>
  Victor Frankenstein has a great ambition: to create intelligent life…
</p>
Try It Yourself

How It Works

  1. Wrap heading + related <p> in <hgroup>.
  2. Use one heading only (h1–h6).
  3. Put the tagline in <p>, not a second heading.
  4. Follow with body copy outside the group.

Example 2 — Document Title Block

A living document title with a last-updated line.

HTML
<hgroup id="document-title">
  <h1>HTML: Living Standard</h1>
  <p>Last Updated 12 July 2022</p>
</hgroup>
<p>Some intro to the document.</p>
Try It Yourself

How It Works

  1. Give the group an id if you need a deep link.
  2. Keep metadata in <p> (dates, editions, slogans).
  3. Outline still uses the <h1> only.
  4. Continue with sections using normal headings afterward.

Example 3 — Style the Group with CSS

Target hgroup and its children to align title and tagline.

HTML
<hgroup class="hero-title">
  <h1>CodeToFun</h1>
  <p>Learn HTML by building</p>
</hgroup>

<!-- CSS idea:
hgroup.hero-title h1 { margin-bottom: 0; }
hgroup.hero-title p { margin: 0; font-weight: bold; opacity: 0.85; }
-->
Try It Yourself

How It Works

  1. Add a class on <hgroup> for the whole unit.
  2. Tighten heading margins so the tagline sits close.
  3. Style the <p> as secondary text (weight, opacity, size).
  4. Keep semantics intact — do not fake the title with a <div>.

Edge Cases & Pitfalls

outline

Expecting a new outline node

<hgroup> does not add an outline entry. Only the heading inside it counts.

content

Multiple headings inside

Only one h1–h6 is allowed. Extra headings belong outside the group.

fake

Styled <p> as a heading

The real heading must be an h* element. Do not replace it with a large paragraph.

header

hgroup vs header

<header> is broader introductory content. <hgroup> is only heading + related <p>s.

seo

Keyword stuffing in taglines

Keep the subtitle short and related. The outline still hinges on the real heading text.

empty

Group with no heading

Without an h1–h6, the group loses its purpose. Always include the heading.

Browser Support

The <hgroup> element is core HTML in every modern browser. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<hgroup>

Widely available since about July 2015. Chrome, Firefox, Safari, Edge, and Opera all support it.

98% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer 9+
Supported
<hgroup> Widely supported

Bottom line: Safe to use for title + tagline groups. Remember: only the inner heading affects the outline.

Key Takeaways

  • Role: groups one heading with related <p> content.
  • Outline: only the heading inside contributes.
  • Model: p* + one h1–h6 + p*.
  • Practice: style the group; keep semantics honest.

One line: use <hgroup> for a heading plus its tagline <p>s — not for multiple headings.

Default CSS Settings

User-agent stylesheets typically treat <hgroup> as a block:

default.css
hgroup {
  display: block;
}

Spacing between title and tagline comes from your CSS on the heading and paragraphs.

Frequently Asked Questions

hgroup groups a single h1–h6 heading with one or more related p elements — for example a subtitle, alternative title, or tagline — so they are treated as one heading unit visually and semantically.
No. hgroup supports only the global HTML attributes such as id, class, and lang.
No. hgroup itself does not add an outline entry. Only the single allowed heading inside it contributes to the document outline.
Zero or more p elements, then exactly one h1–h6, then zero or more p elements. The paragraphs hold the related secondary content.
No. Only one heading is allowed. Put secondary lines in p elements, not extra h2–h6 tags.
Its implicit role is group. You may use other roles when appropriate, but the default grouping is usually enough.

Next: hr

Continue with the HTML hr tag tutorial.

hr tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful