Headings: [Skip]

Web-Design Tutorials by Dr Sam

Heading Tags in XHTML

Menu [Skip]

compass

Purpose

Explanation

There are six, descending levels of headings in XHTML 1.0 (just as there are in HTML 4.01 and 5.0).

<h1> ... </h1>
<h2> ... </h2>
<h3> ... </h3>
<h4> ... </h4>
<h5> ... </h5>
<h6> ... </h6>

We use them to create headings and sub-headings in the body of our documents:

We can use as few or as many as we need:

We can repeat a level:

Example

Three levels are used in this document, our current web-page, as follows.

See how they create an outline of the page contents.


Misuse

Novices tend to select a heading tag because of its size instead of its purpose.

For instance, a novice might select the third-level heading tag <h3> to create the top heading of a page (instead of using the first-level heading tag <h1> for this purpose), because the third-level looks nice at its default 14-point size.

The novice is not aware yet about the purpose of the heading tags. Nor does the novice know enough yet about CSS, which can change the appearance of the tags.


Importance

The correct use of the heading tags is important for:


Creativity with CSS

Explanation

We can change the appearance of the headings with CSS.

Examples.


Validate

The W3C will check your work to help you.

Just do this:

  1. Go to the W3C Markup Validation Service.
  2. Choose "More Options".
  3. Select "Show Outline".
  4. Submit your web-page — and click to "Check".
  5. Then in parse results, find the "Outline".

    There, the validator will have reproduced the sequence of your heading tags.

    The validator will alert you if you have omitted a level or otherwise confused the sequence of these tags.

Notice: XHTML validation first!