[html5] h3 - h6: What's the best practice when in a section/article?

Ian Hickson ian at hixie.ch
Wed Sep 19 14:21:31 PDT 2012


On Wed, 19 Sep 2012, Micky Hulse wrote:
> 
> Noob question:
> 
> When in a <section> or <article> (for example), what's the best way to 
> handle h1 - h6?

That's a bit of a vague question, but basically:

If you have subheadings, as in:

> 		<h1>My main header</h1>
> 		<h2>Subhead goes here</h2>

...then you probably want <hgroup>:

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

When you have subsections, as in:

> 	<p>Maybe a description of section goes here...</p>
> 	<h3>Heading used to divide paragraphs</h3>
> 	<p>Here's a paragraph...</p>
> 	<h3>Heading used to divide paragraphs</h3>
> 	<p>Here's a paragraph...</p>
> 	<h3>Heading used to divide paragraphs</h3>
> 	<p>Here's a paragraph...</p>

...then those are either <h2>s or <section>s with their own <h1>s.


I recommend looking around the examples in the spec, and if you have any 
mroe questions, please feel free to ask them! It's easier to answer 
concrete questions, so if you have an example page with real content that 
might be easier to help with.

Cheers,
-- 
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