Definition
The <hgroup>
HTML element is used to group multiple heading elements (<h1>
to <h6>
) that are part of a single heading section or have a common purpose. It helps provide additional structure and semantics to the heading hierarchy within a web page.
However, it’s important to note that the <hgroup>
element has been deprecated in HTML5, which means it’s no longer recommended for use. This is because it can often be achieved with proper structuring and nesting of heading elements without the need for an explicit grouping element.
Here’s an example of how the <hgroup>
element was used:
<hgroup>
<h1>Page Title</h1>
<h2>Subtitle</h2>
</hgroup>
In this example, the <hgroup>
element wraps an <h1>
element representing the main title of the page and an <h2>
element representing a subtitle or additional information.
To achieve a similar effect without using the deprecated <hgroup>
, you can simply nest the headings within their appropriate hierarchy:
<h1>Page Title</h1>
<h2>Subtitle</h2>
By nesting the headings properly, you maintain the semantic structure and hierarchical relationship between the headings, achieving the desired grouping effect.