W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2010

[whatwg] Headings and sections, role of H2-H6

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 30 Jul 2010 01:36:54 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1007300117220.7470@ps20323.dreamhostps.com>
On Wed, 28 Apr 2010, Jesse McCarthy wrote:
>
> I see why H2-H6 are retained for certain uses, but -- except in an HGROUP --
> there's no good reason to use H2-H6 when writing new code with explicitly
> marked-up sections, is there?

The only reason is backwards-compatibility with existing browsers.


> In that scenario isn't using just H1 throughout decidedly preferable to 
> using H2-H6?  And if so, then as long as authors are being strongly 
> encouraged to mark up headings a certain way, wouldn't it be ideal to 
> state a clear preference for using H1 throughout and include a third 
> code example, indicated as the ideal:
> 
> <body>
> <h1>Apples</h1>
> <p>Apples are fruit.</p>
> <section>
>  <h1>Taste</h1>
>  <p>They taste lovely.</p>
>  <section>
>   <h1>Sweet</h1>
>   <p>Red apples are sweeter than green ones.</p>
>  </section>
> </section>
> <section>
>  <h1>Color</h1>
>  <p>Apples come in various colors.</p>
> </section>
> </body>

Done.


On Thu, 29 Apr 2010, Steve Dennis wrote:
> 
> The other thing to take into consideration is Content Management 
> Systems.  The <section> model, while technically a much better document 
> model, will be much much harder for things such as rich text editors to 
> implement I would imagine.  Due to sections often being visually 
> invisible, the nesting of invisible elements can get unmanageable and 
> broken very easily if clients with little understanding of the document 
> model (probably 99% of them) are editing their own content via WYSIWYG a 
> lot.  The non-nested system of the <h1> - <h6> is much easier due to 
> being single tags with no nesting, and every element being visually 
> distinct.

Indeed. The "old" mechanism is still a fully valid part of HTML, and how 
it interacts with <section> is intentionally fully defined to allow both 
systems to cooperate.


On Fri, 30 Apr 2010, Nikita Popov wrote:
>
> I personally prefer using <h1-6> and do not see, why always using <h1> 
> may be better.

In editing the HTML spec itself, I often have to move sections around. 
Each time I do that, if I move a group of sections "up" or "down" the 
hierarchy, I have to go through each heading and make sure it's the right 
level. With <section> and <h1>, I wouldn't have to do that.


> Beyond that, using <h> instead of <h1> would even be more backwards 
> compatible to the HTML 4 use of headings.

Actually, it would be less compatible, since it wouldn't render like a 
heading in older browsers.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 29 July 2010 18:36:54 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:25 UTC