[whatwg] Re: <section> and headings

Lachlan Hunt lachlan.hunt at iinet.net.au
Wed Sep 1 19:32:04 PDT 2004

James Graham wrote:
> On 31 Aug 2004, at 16:14, Lachlan Hunt wrote:
>> In order to preserve the semantics of hn elements, I would produce 
>> this outline:
>> 1. Level 1 Heading
>>    2. Level 2 Heading
>>    2. Level 2/3? Heading
>> Although it may not necessarily be structurally correct for that 
>> document structure, the semantics of hn elements are preserved.
> Ack. So presumably:
> <section>
>     <h>Level 1 Heading</h>
>     <section>
>         <h>Level 2 Heading</h>
>         <section>
>             <h4>Level 2/4? Heading</h4>
>         </section>
>     </section>
> </section>
> Would have a level 4 heading with no level 3 heading? Yuck. Sure that's 
> bad markup but authors use it surprisingly often.

So, what outline would this produce?
     <h1>Heading 1</h1>
     <h2>Heading 2</h2>
     <h4>Heading 4</h4>

IMO, the two are semantically equivalent, and should produce identical 
outlines.  They should both produce this outline that the validator 

*  Heading 1
       o Heading 2
             + A level 3 heading is missing!
                   # Heading 4

>> <body>
>>     <h>Heading 1</h>
>>     <section>
>>         <h>Heading 2a</h>
>>         <h2>Heading 2b</h2>
>>         <section>
>>             <h2>Heading 2c</h2>
>>         </section>
>>     </section>
>>     <h2>Heading 2d</h2>
>> </body>
>> ...
>> Heading 1
>>     Heading 2a
>>     Heading 2b
>>     Heading 2c
>>     Heading 2d
> I disagree that this should be the interpretation of the markup above. 
> Heading 2c should be a level lower than 2b

Ok, let's look at that a bit closer.  If I understand you correctly, 
then each section should start with an h1, and subsequent headings 
should be regarded as various levels of sub heading.  Thus, there are 
several missing headings:

* Heading 1
     o Heading 2a
     o A Level 2, Heading 1 is Missing! **
     -o Heading 2b
         + A Level 3, Heading 1 is Missing!
         -+ Heading 2c
* A Level 1, Heading 1 is Missing! **
-* Heading 2d

** Note: Missing Headings marked with ** could possibly be assumed to be 
the headings just maked up with <h>, but I don't really like mixing 
numbered headings with unnumbered headings, since an <h> could only ever 
fill in for an <h1> in that case.

> (I also think that only the 
> first heading in a section should be regarded as a section title, the 
> rest as subtitles. But I'm more ready to be persuaded that that's a bad 
> idea)

No, that is a bad idea.  Same-level structured headings should not be 
regarded as sub headings for the purpose of an outline.  (Numbered 
headings should work as I have already described.)
     <h>Heading A</h>
     <h>Heading B</h> <!-- This is not a sub heading -->

unless you want to force authors to have to do the following which, from 
my experience of using divs for the same purpose, can result in an 
unmanageable structure when there are lots of headings.

     <h>Heading A</h>
     <h>Heading B</h>

Lachlan Hunt

lachlan.hunt at lachy.id.au

More information about the whatwg mailing list