[whatwg] Question on (new) header and hgroup

Thomas Broyer t.broyer at gmail.com
Thu May 7 08:34:08 PDT 2009


On Thu, May 7, 2009 at 5:15 PM, Bruce Lawson <brucel at opera.com> 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?

No longer, as <header> is not a sectioning element (IIUC).

> 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>
>
> ?

The answer is in the second example of <header> (copied thereafter for
convenience):

http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-header-element

In this example, the page has a page heading given by the h1 element,
and two subsections whose headings are given by h2 elements. The
content after the header element is still part of the last subsection
started in the header element, because the header element doesn't take
part in the outline algorithm.

<body>
 <header>
  <h1>Little Green Guys With Guns</h1>
  <nav>
   <ul>
    <li><a href="/games">Games</a> |
    <li><a href="/forum">Forum</a> |
    <li><a href="/download">Download</a>
   </ul>
  </nav>
  <h2>Important News</h2> <!-- this starts a second subsection -->
  <!-- this is part of the subsection entitled "Important News" -->
  <p>To play today's games you will need to update your client.</p>
  <h2>Games</h2> <!-- this starts a third subsection -->
 </header>
 <p>You have three active games:</p>
 <!-- this is still part of the subsection entitled "Games" -->
 ...

-- 
Thomas Broyer


More information about the whatwg mailing list