HTML BasicsHTML defines six heading levels: <h1>,
<h2>, <h3>,
<h4>, <h5>,
<h6>. These should be thought of as (roughly)
analogous to Chapters, Sections, and Subsections, etc., in a
conventional document.
In general, the intent of a heading is to say something about the text that follows the heading (see below for some grudged exceptions). Tim Berners-Lee, principal architect of the World Wide Web, put it clearly:
Always use heading levels in order, with one heading level 1 at the top of the document, and if necessary several level 2 headings, and then if necessary several level 3 headings under each level 2 heading. If you don't like the way heading level 2 is formatted, fix it on your client, don't just skip to heading level 3.
(He said some other good things that are well worth reading).
The key point is that <h1> should identify the
MAJOR HEADING for the document and that
<h2>, <h3> , etc. should identify
succesive 'nested' sections and subsections within a heading.
Although it isn't made explicit in the syntax of HTML, it is
unquestionable that every document should have exactly one and only
one <h1> element.
A very good way to determine which heading level is appropriate for a particular portion of your document is to consider how that section would be treated in an outline, with the 'title' of the document being heading level one. For an outline with headers numbered in this fashion
1. Chapter 19:
1.1
1.2
1.2.1
1.2.1.1
1.3
you can directly translate the number of subsection "fields" to heading levels, thus:
Outline number Heading level
______________ _____________
1. Chapter 19 h1
1.1 h2
1.2 h2
1.2.1 h3
1.2.1.1 h4
1.3 h2
Note that using this method will guarantee that you obey the "use heading levels in order".
Sometimes documents have a small quantity of preliminary material, such as a Journal title, volume, and issue number that is repeated from article to article. It is not always inappropriate to do something like
<h3>Scientific American<br> January 1995</h3> <h1>Ensuring the Longevity of Digital Documents</h1>
Similarly, repeated material at the tail of every document might appropriately be given the same kind of markup, even if it violates the general rule.
It is common but regretable practice to use
headings in order to achieve the typographic effect which they happen to
produce on one browser or another. Often authors think that
<h1> is bigger then <h2>.
<h2> than <h3>, etc. This produces
documents that make no sense, are extremely device-dependentent, and whose usefulness is
limited to the period during which that particular browser behaves in
that particular way. It produces documents that are confusing when
viewed on other browsers and ironically, even on the intended browser,
since readers are (with most browsers) free to set the display
paramaters for each element to suit their own taste, visual needs, or
hardware capabilities. In other words this doesn't
work.