Path // www.yourhtmlsource.comReference → <hgroup>

<hgroup>


The <hgroup> element represents a heading and related content. It groups a heading element (h1-h6) with one or more p elements containing subtitles, alternative titles, or taglines. This element is useful when you have a multi-level heading where only the primary heading should contribute to the document outline.

Clock This page was last updated on 2025-11-17



Syntax

<hgroup>
  <h1>Main Heading</h1>
  <p>Subtitle or tagline</p>
</hgroup>

The element requires both opening and closing tags. An hgroup must contain at least one heading element (h1-h6) and can include multiple p elements for subtitles or related content. Only the highest-ranking heading contributes to the document outline.

Attributes

  • Global attributes - The <hgroup> element supports all global attributes such as id, class, style, lang, and dir.

The <hgroup> element has no element-specific attributes.

Examples

Main Title with Subtitle

<hgroup>
  <h1>HTML5 Semantic Elements</h1>
  <p>A Complete Guide to Modern Web Structure</p>
</hgroup>

Article with Title and Tagline

<article>
  <hgroup>
    <h2>Breaking: New Web Standard Released</h2>
    <p>The Future of the Internet Starts Today</p>
  </hgroup>
  <p>Article content...</p>
</article>

Page Header with Multiple Lines

<header>
  <hgroup>
    <h1>Your HTML Source</h1>
    <p>Learning HTML Has Never Been Easier</p>
    <p>Tutorials, References, and Best Practices</p>
  </hgroup>
  <nav>...navigation...</nav>
</header>

When to Use

Use the <hgroup> element when:

  • Pairing a heading with a subtitle that shouldn't be in the outline
  • Adding a tagline or slogan to a page title
  • Including an alternative title or translation
  • Grouping a chapter title with its chapter number
  • Creating a heading with an explanatory subheading

Do NOT use <hgroup> when:

  • You only have a single heading with no subtitle (just use the heading directly)
  • The secondary text is not related to the heading (use separate elements)
  • You want both headings to appear in the document outline (use separate headings)
  • The subtitle is actually a paragraph of introductory text (that's not a subtitle)

Important: The hgroup element was removed from the HTML5 spec for a period but was restored in the HTML Living Standard. It provides semantic meaning that the grouped content represents a single conceptual heading with supporting text.

  • <h1>-<h6> - Heading elements used within hgroup
  • <header> - Often contains hgroup elements
  • <article> - Self-contained content with headings
  • <section> - Generic sectioning element
  • <p> - Paragraph element used for subtitles in hgroup