How to use <hx> tags

How should <hx> tags be used? Tomas Jogin poses the question with some interesting points in his blog.

Using the W3C validator, Tomas clearly shows that common thoughts on the use of heading tags is slightly off, though puts that down to vagueries of the spec and us web developers then interpreting them.

Tomas’ Hierarchy entry explains very well the issue at hand, but does Document Outline agree with the Specification?
The HTML4.01 Specs state

A heading element briefly describes the topic of the section it introduces. Heading information may be used by user agents, for example, to construct a table of contents for a document automatically.

There are six levels of headings in HTML with H1 as the most important and H6 as the least. Visual browsers usually render more important headings in larger fonts than less important ones.

The way the Document Outline works seems a bit different to this. The Specs specifically state that the different heading levels denote different levels of importance, not whereabouts in the hierarchy of the structure they appear.

In the comments of Tomas’ post, Dan Cederholm says ” I’ve always looked at heading order as a level of importance, and sidebar items aren’t as important (to me) as entry titles. But the outline view from the W3C is telling us something different.”. And again, looking at the specs, Dan’s opinion prior to this post seems to be in line with the W3C’s thoughts. Which is different to the way the Document Outline works.

You can then argue that the first part of the Spec says “Heading information may be used by user agents, for example, to construct a table of contents for a document automatically.”, which seems more inline with the Document Outline way of displaying things.

So, in my mind, we seem to have 2 adjacent paragraphs of a specification that are at odds with each other. We can probably put this down to when the specs were written and the lower level of discussions of semantics at that time. But which is correct?

Hmm, I think I’ll plant myself on the fence for the moment, I would tend to lean towards the kind of setup that the Document Outline suggests though I think. It does seem to make more semantic sense.

Leave a Reply