Sajjad
Sajjad

Reputation: 237

Why was the <hgroup> tag added to HTML5?

Why was the <hgroup> tag added to HTML5? What’s their technical usage? What’s the grouping advantage?

Upvotes: 2

Views: 4831

Answers (2)

devric
devric

Reputation: 3665

It gives more defined selection, eg:

h1 {font-size:5em}                   output: font-size 5em
h2 {font-size:2em; color: black}     outout: font-size 2em, black

using them in a hgroup, you would get

hgroup h1 {font-size:3em}            output: font-size:3em
hgroup h2 {color:grey}               output: font-size:2em (from above defined), grey 

Upvotes: 1

Thomas Kj&#248;rnes
Thomas Kj&#248;rnes

Reputation: 1927

The problem with headers and their 'levels' arises when you generate dynamic content. Let's say you have a more or less fixed H1 and H2 combo and the page, and you have an article section with dynamic content that comes from a rich editor.

Traditionally it would be problematic at best to try and guess which header leveles to allow in the editor markup.

I haven't studied the hgroup element in detail, but I have read the article above and others, and it seems logical to me that the hgroup element can be used to 'reset' the level numbering, so that dynamic content in a rich editor can start using H1.

Upvotes: 0

Related Questions