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

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

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 31 Mar 2005 10:33:00 +0000 (UTC)
Message-ID: <Pine.LNX.4.61.0503311009300.25644@dhalsim.dreamhost.com>

Thanks for the feedback!

On Wed, 30 Mar 2005, Brad Fults wrote:
> 
> Firstly, I don't think a paragraph preceding a section header should be 
> associated with that section. For instance, if one puts a commentary 
> before a book (and thus before Chapter 1), the commentary isn't meant to 
> be part of Chapter 1.

So what would it be associated with? (And wouldn't the first header in a 
book be the book's title, which it _would_ make sense for the paragraph to 
be associated with?)

I'm concerned that if we imply a section before the first header, a lot of 
documents are going to end up with implied first sections that will look 
silly in outliners. A lot of documents have things before their main 
header, if only advertising, introductory paragraphs, or the like.


> Second, I take issue with the way sections carry past nested elements 
> such as the ordered list. In your example, this would apply to the 
> paragraph immediate after the ol (I don't think it should be part of 
> section H, but rather the last section defined before the ol--section E.
> 
> Likewise, this applies to the paragraph immediately following the div 
> under section J; I believe the paragraph should also be in section J 
> rather than the nested section K.

While I agree with the <ol> case, I don't agree with the <div> case. It 
would break a huge number of pages on the Web if we said that headers were 
scoped to their parent <div>s, because this kind of markup, however, 
silly, is very common:

   <div class="header">
    <div class="header inside">
     <h1>Hello World</h1>
    </div>
   </div>
   <p> ... </p>

Now, given that the headers' sections must "leak out" of <div>s, the 
question becomes "do we want to hard-code the <li> case?".

I don't think we do. I think requiring outline generators to look at the 
markup at that level of detail would almost guarentee that the algorithm 
would never be widely implemented.


On Wed, 30 Mar 2005, J. King wrote:
>
> > What about if there are multiple <h1> elements on the page?
> 
> Is there any reason there shouldn't be? 

Not particularly, it's just that if <h1> defines the top-level 
(unnumbered, in my sample outline) header, then a second one will look a 
bit weird (since it will start a new numbering hierarchy).


> There isn't any need for a single, root <section> element; that's 
> redundant, isn't it?  <h1> shouldn't be unique simply because it's the 
> first, if you ask me.  A lot of people like to use it for the document 
> title, but we -do- have <title> for that...

<title> and <h1> are different -- <title> is for a context-independent 
title that can be used in bookmarks and other places, the <h1> is for a 
context-sensitive version.

For example,

   <title>Current events - Wikipedia, the free encyclopedia</title>

...vs:

   <h1>Current Events</h1>


On Wed, 30 Mar 2005, dolphinling wrote:
> > 
> > Any objections? Any other edge cases that I have forgotten?
> 
> This makes it impossible to later specify a <section> element.

Nah, <section> would just be explicitly part of the section-generating 
process. I'm just trying to get <h1>-<h6> down before we start introducing 
the new elements to the mix.


On Wed, 30 Mar 2005, James Card wrote:
> > 
> > To rephrase the question a little, what would we want to put in HTML4 
> > if we were writing an errata for HTML4 section 7.5.5?
> 
> I would prefer to see this handled as it in ISO/IEC 15445. See <URL: 
> http://www.cs.tcd.ie/15445/UG.HTML#H1.NEST >.

That's pretty vague too, the only thing it really answers is a question I 
didn't raise, namely "is <h1></h1><h3></h3> legal". I agree that it 
shouldn't be and will include that conformance requirement in the spec. 
However, we still have to define what that markup means and how outliners 
should handle it.


On Thu, 31 Mar 2005, James Graham wrote:
>
> On another point, in general, I don't like adding anonymous headings 
> [...] although, theoretically, this allows added flexibility when 
> dealing with highly structed documents (the type where numbering 
> sections is appropriate), in practice, the majority of documents on the 
> web aren't like this and often authors use structures like:
>
>   <h2>My Sidebar</h2>
>   <h4>Sidebar section</h4>
> 
> Which should outline like
>
>   |--My Sidebar
>     |--Sidebar section
> 
> i.e. without anonymous intermediaries

The question is then, what should this outline to:

   <h2>A</h2>
   <h4>B</h4>
   <h3>C</h3>

...?

(This was one of the examples in my sample outline.)

I see two options:

 1. -- A
       |
       +-- B
       |
       +-- C 

 2. -- A
       |
       +-- <unknown>
       |   |
       |   +-- B
       |
       +-- C

I don't mind which we do. I guess I'm going to go for option 1 (which 
seems to be what you asked for) unless someone thinks 2 is better.


On Thu, 31 Mar 2005, James Graham wrote:
> > 
> > There are two big issues here:
> > 
> > 1. What do <h1> to <h6> mean in a <body>?
> > 
> > 2. What do <h1> to <h6> mean in a <section>?
>
> Incidentially, unless I was convinced otherwise in some way that I've 
> now forgotten, I believe that question 1 and 2 should be the same i.e. 
> <body> should be a special name for the outermost <section>.

<body> has to work the same in HTML5 as in HTML4. An <h1> always means a 
top-level header, etc.

<section> is a new element, which needs to be usable in a 
backwards-compatible way (so that pages still work in today's Lynx), but 
which can (and will) have new semantics to help authors.

While it may be that we end up saying they are the same, their design 
requirements and constraints are different, and they need to be defined 
carefully. Thus I am dealing with them separately.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 31 March 2005 02:33:00 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:39 UTC