- Home
- /
- Tutorials
- /
- HTML Tutorial
- /
- HTML <hgroup> Tag
HTML Tags
HTML <hgroup> Tag
Learn how the HTML <hgroup> tag groups a heading with a subheading, alternative title, or tagline.
The hgroup tag keeps a heading together with its subtitle or tagline, like "Learn Modern HTML" and "A beginner-friendly guide". The heading stays the heading; the tagline is a normal paragraph that belongs to it.
Before <hgroup>, people often used a second heading for the tagline, like an <h2>, which made the outline confusing for screen readers. Now there is one heading, plus a <p> for the extra line. Heading levels are explained in HTML Headings.
Syntax
html
<hgroup>
<h1>Main heading</h1>
<p>Subheading or tagline</p>
</hgroup>There are no special attributes, only the global ones such as class and id.
Example
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hgroup Tag Example</title>
<style>
hgroup {
border-left: 4px solid #29AB87;
padding-left: 16px;
}
hgroup h1 {
margin-bottom: 4px;
}
hgroup p {
margin-top: 0;
color: #555;
font-size: 1.1rem;
}
</style>
</head>
<body>
<hgroup>
<h1>Learn Modern HTML</h1>
<p>A beginner-friendly guide to semantic webpages</p>
</hgroup>
<p>Start with meaningful elements and build accessible content.</p>
</body>
</html>The heading "Learn Modern HTML" appears with its tagline just below it, both grouped with a green line on the left. The paragraph after the group is ordinary body text.
Browser Support
Chrome | Edge | Firefox | Safari | Opera | IE9+ |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |
Good to know
- Put exactly one heading,
<h1>to<h6>, inside an<hgroup>, together with one or more<p>elements. - The tagline is not part of the page outline, so screen readers listing headings will skip it. Keep the essential words in the heading itself.
- Older tutorials show
<hgroup>with several headings inside. That use was removed from the HTML standard.
HTML <hgroup> Tag exercises
Group a title and subtitle
Group the main heading Learn HTML with its subtitle, the paragraph From first tag to full page.
Result
