Why we want headers
Often when you create a list, you will want to place a header
on it that logically describes the contents, like this:
- North America
This makes good sense, and creaters a good structure of information on your
page. But how should you do it?
The wrong way
In the HTML Level 1 textbook the answer is to use the lh
tag. There is just one problem with this: There is no such tag! In fact, I cannot
find any indication that this tag ever existed, though I am certain it did at
one time. The list of elements at the W3C
does not include it, the list of tags at Netscape’s Developer’s
Edge does not list it. I checked all over Microsoft’s Developers’
Network Online and found nothing of it. I checked the Index.html
site and not a mention could be found. This tag is so seriously gone that even
the traces are gone.
What I think happened is that one of the browser companies introduced this
tag in the hope that it would be picked up and made a part of HTML. Clearly,
that did not happen. This tag is definitely not a part of the HTML world, and
should not be used. Period.
The right way
Well, since having a header is a good idea, but the lh tag didn’t make it,
how should you put a header on a list? I think the answer has to be by using
the tools you already have: the header tags h2…h6. You should not use h1 unless
the list is the only thing on the page. h1 headers should always be used to
describe the entire page. But h2…h6 are used to describe sections of a page,
and a list can be a section just as much as anything else can be. When you do
this, the header has to go before the list. The list
tags cannot contain header tags. A good example is how I coded the list I used
above as an example:
- North America
Note that the header comes first, then the list. This keeps your code neat,
tidy, and compliant with the standards for HTML. But it still lets you create
a good logical structure.
List Headers by Kevin O'Brien is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.