The <hgroup> tag in HTML is used to group multiple heading elements (<h1>, <h2>, etc.) together. However, the <hgroup> tag is now deprecated in HTML5 and is no longer recommended for use.
HTML
<!DOCTYPE html>
<html>
<body>
<hgroup>
<h1>This is the heading.</h1>
<h2>This is sub-heading.</h2>
</hgroup>
</body>
</html>
Syntax
<hgroup>
<h1>Main Heading</h1>
<h2>Subheading</h2>
</hgroup>
Example 2: This example contains Title, Sub-Title, and Metadata.
HTML
<!DOCTYPE html>
<html>
<body>
<hgroup>
<h1>This is the title.</h1>
<h2>This is sub-title.</h2>
<p>This is the metadata.</p>
</hgroup>
</body>
</html>
HTML <hgroup> Tag – FAQs
What is the purpose of the <hgroup> tag in HTML?
The <hgroup> tag is used to group multiple header elements, like <h1> to <h6>, into a single logical section, improving document structure.
Is the <hgroup> tag still supported in HTML5?
No, the <hgroup> tag was deprecated in HTML5 and should not be used in modern web development.
Can I use the <hgroup> tag for SEO purposes?
While it was intended to group headings, the <hgroup> tag is no longer supported, so using it for SEO purposes is not recommended.
What tag can replace the <hgroup> tag?
Use a <div> or <section> element to group headings. These elements provide better flexibility and compatibility across all browsers.
Should I remove the <hgroup> tag from older HTML code?
Yes, it’s advisable to remove the <hgroup> tag from older code and replace it with more standard HTML elements like <div> or <section>.