exceptions
Every document should have one, and only one
<h1> element.
Normally H5 and H6 should not be used, and even H4 is rarely needed.
If you feel the need for more than 3 or 4 headings, consider breaking
your document into multiple hypertext nodes (i.e. put the text into more
than one file and adjust the markup accordingly).
![]()
HTML defines six heading levels. These should be thought of as (roughly) analogous to Chapters, Sections, and Subsections, etc., in a conventional document. It should not be thought of as a way to get a particular graphic effect.
A heading element implies all the font changes, paragraph
breaks before and after, and white space necessary to render
the heading, but these changes are the responsibility of the
browser software and the human reading the text, not the
author. Further character emphasis or paragraph marks
are neither required nor appropriate in HTML headings. Nor
can heading appear
For example, <b><h2>Summer Session
Hours</h2></b> is illegal.
<h2><b>Summer Session
Hours</h2></b> is syntactially legal, but very
bad form, since it is the prerogative of the reader and his/her browsing
software to determine the appearance of heading text. (There are
circumstances in which incorporating highlighting markup may be the only
way to convey the meaning of the heading, but these are are rare and do
not justify misuse of the markup rules).
Note that paragraphs following a header (ie those paragraphs that are 'part of the' section, must have p tags surrounding them, despite warnings in some style guides to the contrary.
The heading elements are H1, H2, H3, H4, H5, H6, with H1 being the highest level of heading. For example:
<H1>The Big Problems</H1> <p>Here is some text. It should be considered "part of: heading 1</p> <H2>Overview of the problems</H2> <p>Here is some more text. It should be considered "part of: 'Overview of the problems', ie The first heading 2 <H3>Historical background to the problems</H3> <p>Here is some more text. It should be considered "part of: 'Historical background', ie Heading3 <H2>Problem 1: The Economic situation</H2> <p>Here is some more text. It should be considered "part of: 'Problem 1: The Economic Situation', ie the second Heading 2 </p>
Although heading levels can be skipped (for example, from H1 to H3), this practice is discouraged as skipping header levels may produce unpredictable results when generating other representations from HTML.
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.
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.