Headings
Headings are block-level elements used to add structure to text. There are six levels of heading, numbered 1 to 6 with 1 being the top level; for example <h1></h1>. The heading level number appears in both opening- and closing tags.
Headings cannot contain other block-level elements, but they can contain inline tags such as anchors and phrase elements.
While the rules regarding headings are more relaxed than other structural elements, such as lists, they should still be used structurally rather than for appearance. This means that while correct syntax does not actually forbid following an <h2> with an <h4>, it is not good practice to skip a level downwards. Apart from anything else it leaves fewer places to go. An <h3>, should be followed by an <h4>, another <h3> or an <h2> or <h1>. In other words, either take one step down, remain on the same level, or step up to any higher level. Treat headings like the outline hierarchy in a word processor.
The hierarchy of headings becomes especially important when we want to build well-ordered contents lists, and starting with a clear structure will help us greatly when we come to this task.
The exact appearance of the heading will vary depending on what styles are applied to the page, or sometimes on the context within which it is found. This is down to the visual design of the site and such visual considerations should never influence the choice of heading level. It is purely a matter of the structure of the document.
The most prominent heading is <h1> and there should be only one per page (usually the <h1> heading is the same as the title and is inserted automatically when the page is generated from the database, so begin at <h2>).
Here are some examples of headings:
This is a level 2 heading
This is a paragraph following a second level heading.
This is a level 3 heading
This is a paragraph following third level heading.
for which the code looks like this:
<h2>This is a level 2 heading</h2>
<p>
This is a paragraph following a second level heading.
</p>
<h3>This is a level 3 heading</h3>
<p>
This is a paragraph following third level heading.
</p>
