W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2005

[whatwg] <h1> to <h6> in <body>

From: Matthew Raymond <mattraymond@earthlink.net>
Date: Mon, 04 Apr 2005 10:11:05 -0400
Message-ID: <42514AF9.9040606@earthlink.net>
    Okay, here's my two cents on the heading/section issue...

    The element <h1> can be used in HTML4 multiple times. Therefore, it 
is not by default the title of a document. The most natural thing to 
assume is that <title> is the title of the document, regardless of how 
people might abuse it. At best, you could say that when there is only 
one <h1> element, it might be the title. Even that is not a certainty.

    There are already <meta> values for much of the stuff that people 
abusively put in the <title> element. For example, "author" metadata is 
pretty much a standard already:

| <meta name="author" content="Space Dog">

    Therefore, why not just standardize it and deprecate the use of such 
values in <title> while giving <title> more specific semantics? 
Something like this:

| <meta name="author" content="Ian Hickson">
| <meta name="sitename" content="WHATWG">
| <meta name="publisher" content="Hixie Industries">

    The <link> element can be used for the stuff that requires a URL or 
hyperlink of some kind.

    As for sections, in my opinion there are two types of sections. The 
first is what we have now, an implied section system that is difficult 
to define but essentially goes from the beginning of one heading to the 
beginning of the next. The second type of section is one defined by 
markup such as <section>. This type should be the only type that can be 
styled and affect rendering.

    Generally, implied sections should begin at the beginning of a <h#> 
element and end at either the end of the document or at the beginning of
another <h#> element. Allowing exceptions makes describing implied 
sections much more complicated. If developers need flexibility with 
regard to this, we can use language that says developers *should* start 
and end sections in such a manner rather than *must*.

    Importance (given by the number of the <h#> element) determines 
styling, and it implies structure, but the level of importance should 
not create missing sections within the document outline. If the 
importance level of a heading implies a missing parent section, the 
outline tree should first be constructed as if the implied nodes 
existed, then the children of missing sections should be collapsed into 
the position of their parents.

    That said, this is how I would process the sample markup:

     <body>
      <p>...</p>               <unnamed section>
      <h1>A</h1>               1        A (importance level 1)
      <h2>B</h2>               1.1      B (importance level 2)
      <h3>C</h3>               1.1.1    C (importance level 3)
      <h2>D</h2>               1.2      D (importance level 2)
      <h3>E</h3>               1.2.1    E (importance level 3)
      <p>...</p>                        E
      <ol>                              E
       <li>                             E
        <h3>F</h3>             1.2.2    F (importance level 3)
       </li>                            F
       <li>                             F
        <h3>G</h3>             1.2.3    G (importance level 3)
       </li>                            G
       <li>                             G
        <h3>H</h3>             1.2.4    H (importance level 3)
       </li>                            H
      </ol>                             H
      <p>...</p>                        H
      <h4>I</h4>               1.2.4.1  I (importance level 4)
      <h2>J</h2>               1.3      J (importance level 2)
      <div>                             J
       <p>...</p>                       J
       <h2>K</h2>              1.4      K (importance level 2)
       <p>...</p>                       K
      </div>                            K
      <p>...</p>                        K
      <h3>L</h3>               1.4.1    L (importance level 3)
      <h2>M</h2>               1.5      M (importance level 2)
      <h4>N</h4>               1.5.1    N (importance level 4)
      <h3>O</h3>               1.5.2    O (importance level 3)
      <h1>P</h1>               2        P (importance level 1)
      <h1>Q</h1>               3        Q (importance level 1)
      <h2>R</h2>               3.1      R (importance level 2)
     </body>


    This would be the outline:

Document
     |
     +-- <unnamed section>
     |
     +-- 1 A
     |   |
     |   +-- 1.1 B
     |   |   |
     |   |   +-- 1.1.1 C
     |   |
     |   +-- 1.2 D
     |   |   |
     |   |   +-- 1.2.1 E
     |   |   |
     |   |   +-- 1.2.2 F
     |   |   |
     |   |   +-- 1.2.3 G
     |   |   |
     |   |   +-- 1.2.4 H
     |   |       |
     |   |       +-- 1.2.4.1 I
     |   |
     |   +-- 1.3 J
     |   |
     |   +-- 1.4 K
     |   |   |
     |   |   +-- 1.4.1 L
     |   |
     |   +-- 1.5 M
     |       |
     |       +-- 1.5.1 N
     |       |
     |       +-- 1.5.2 O
     |
     +-- 2 P
     |
     +-- 3 Q
         |
         +-- 3.1 R
Received on Monday, 4 April 2005 07:11:05 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:21 UTC