Hgroup groups a heading with a subtitle or other supporting text that is not a separate heading level. It helps avoid introducing a misleading extra heading.
What You Need to Know
A plain paragraph can serve as the subtitle. If the subtitle really begins a new section, it should be a real heading instead.
The goal is not to collect as many tags as possible. Pick the element that best describes what the content really is.
Example: See It in Action
Add this example to the appropriate part of a practice HTML page. Read each line before you open the page in your browser.
This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.
<hgroup>
<h1>Science Club</h1>
<p>Explore, discover, and build</p>
</hgroup>
Let’s Understand the Example
- Hgroup groups a heading with closely connected secondary wording.
- An h1 introduces the main subject of the page. Use the heading level for structure rather than font size.
- A p groups a paragraph of related text. Start another paragraph for a new thought.
You should see a readable heading and its related content. The heading level tells readers how the ideas fit together, not merely how large the letters look.
What Should You See?
The page should display “Science Club” as a heading, followed by its related content. Change the heading text and refresh the browser to see the result.
Read only the headings, from top to bottom. Do they tell a sensible story? If not, move sections or choose levels that match the content.
Try It Yourself
- Put a short subtitle under the h1 without creating another heading level.
- Save your changes, open or refresh the page, and compare the result with the original example.
- Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.
Common Beginner Mistakes
- Turning a decorative tagline into h2 and confusing the document outline.
- Avoid picking tags just for their default bold, italic or spaced appearance. Use CSS for presentation.
Key Takeaways
- Hgroup groups a heading with a subtitle or other supporting text that is not a separate heading level.
- Hgroup groups a heading with closely connected secondary wording.
- A plain paragraph can serve as the subtitle. If the subtitle really begins a new section, it should be a real heading instead.