[html5] headers

Ian Hickson ian at hixie.ch
Mon Apr 6 11:28:17 PDT 2009


On Mon, 6 Apr 2009, Stephen Stewart wrote:
> > > 
> > > I was going to ask a question about the semantics and order of h1-6 
> > > headers within a header element but I think my particular issue is 
> > > solved by this line in the spec: "Sections may contain headers of 
> > > any rank, but authors are strongly encouraged to either use only h1 
> > > elements, or to use elements of the appropriate rank for the 
> > > section's nesting level."
> > 
> > That's trying to refer to <section>s and <article>s and so forth -- 
> > within <header> you should feel free to use any of them, the whole 
> > <header> then acts like a single <h1> from a semantic standpoint.
> 
> Cool. Out of interest then, why would I use <header> instead of:
> 
> <h1>
> <p>Typeline</p>
> <p>Mainline</p>
> </h1>

The main use case is providing two levels of headers, e.g.:

   <header>
    <h1>Typeline</h1>
    <h2>Mainline</h2>
   </header>

...but if we did that with <h1> instead of <header>, the parsing would 
break (the <h2> would imply the end of the <h1>, if I recall correctly).

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the Help mailing list