[whatwg] Question on (new) header and hgroup

James Graham jgraham at opera.com
Thu May 7 08:34:21 PDT 2009


Bruce Lawson wrote:
> I'm struggling to understand the reasons for <hgroup>: wouldn't one or
> more h1..h6 elements wrapped in the same <header> imply just such a
> grouping without the need for such an element?
> 
> To illustrate my query, what is the difference between
> 
> <header>
> <h1>HTML 5</h1>
> <h2>a new era of loveliness</h2>
> <nav> ... </nav>
> </header>
> 
> and
> 
> <header>
> <hgroup>
> <h1>HTML 5</h1>
> <h2>a new era of loveliness</h2>
> </hgroup>
> <nav> ... </nav>
> </header>

<hgroup> affects the document structure, <header> does not. So if you 
made an outline view of your document, the examples above would look 
(with the addition of a <hx> element inside the nav with content 
"Navigation") like

+--HTML 5
    +--A new era of loveliness
       +--Navigation

+--HTML 5 - a new era of loveliness
    +--Navigation

So, in the first example "A new era of loveliness" is a real section 
heading and the navigation becomes a subsection of that section. In the 
second example the <hgroup> element tells us that the <h1> and <h2> 
elements form a heading-subheading pair and that the navigation is a 
subsection of the section headed by this heading/subheading pair.

Is that any clearer?


More information about the whatwg mailing list