[whatwg] Headings and sections, role of H2-H6
Jesse McCarthy
whatwg-2010-04 at jessemccarthy.net
Wed Apr 28 16:47:56 PDT 2010
I think the new section and heading model in HTML 5 is a welcome
development. I've actually essentially been doing it that way for years --
eschewing H2-H6 and using DIV as a stand in for SECTION. I've always
considered the H1-H6 concept a mess, and thankfully that seems to have been
recognized by the people working on this spec.
My understanding is that in HTML 5 the following is acceptable, and at least
as acceptable as the alternative: use just H1, in conjunction with SECTION;
forego use of H2-H6 for the most part; and, allow heading level to be
determined by section nesting level. Is that correct?
My question is about the explanation and code sample in the HTML 5 Working
Draft section [4.4.11 Headings and sections]:
"Sections may contain headings 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"
There are 2 code examples shortly after that passage, and the following one
is indicated as being preferable to the other one because the sections are
explicitly marked up instead of implied:
<body>
<h1>Apples</h1>
<p>Apples are fruit.</p>
<section>
<h2>Taste</h2>
<p>They taste lovely.</p>
<section>
<h3>Sweet</h3>
<p>Red apples are sweeter than green ones.</p>
</section>
</section>
<section>
<h2>Color</h2>
<p>Apples come in various colors.</p>
</section>
</body>
My point is that the passage makes it seem like using H1 throughout vs.
using "elements of the appropriate rank for the section's nesting level" are
equally sound and encouraged, and the code sample uses H2 and H3.
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? 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>
More information about the whatwg
mailing list