[whatwg] Should default styles for h1-h6 match the outlining algorithm?

Tab Atkins Jr. jackalmage at gmail.com
Thu Apr 29 17:37:04 PDT 2010


On Thu, Apr 29, 2010 at 11:26 AM, L. David Baron <dbaron at dbaron.org> wrote:
> http://www.whatwg.org/specs/web-apps/current-work/multipage/sections.html#headings-and-sections
> defines an outlining algorithm that gives each heading an outline
> depth that doesn't necessarily match its h1-h6 number (at least as I
> understand it, although I admit I haven't read the details).
>
> There's been a bit of discussion at various times on www-style and
> in other places about adding selectors that would allow CSS to match
> on HTML's outline depth.
>
> However, I was somewhat surprised to see that the rendering section
> http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#fonts-and-colors
> suggests default styles for h1-h6 that don't reflect the outline
> depth at all.  Should it?
>
> Is the design of the outline algorithm in HTML5 intended to result
> in better default styles for headings?
>
> Or is it expected that the default styles are generally wrong but
> that CSS provides selectors that let authors easily improve them?
> (Why?)

Hmm?  Yes it does.  It's not in the initial block, but in the next one
down, because it has to explain what it means to have the "x" selector
there.  It similarly defines the margins for <h1>s based on nesting
depth in the appropriate section.

The rules are relatively simple, in that they only pay attention to
nested <h1>s specifically, but that seems fine.  An author can either
use just <h1-6> and no sectioning elements, or just <h1> and
sectioning elements.  Further control, allowing for nesting of <h2-6>
within sectioning elements, can be manually controlled by the author.

I still think we should provide a :heading(n) pseudoclass, but the
basic use-case is covered in the spec fine.

~TJ



More information about the whatwg mailing list