Welcome to WebHeadStart.org

Web Technologies

Sponsored By

WebHeadStart.org is currently in beta.
Please pardon our appearance as we work to provide you with the most comprehensive reference on today's web technologies.

Interested in advertising on WebHeadStart? Become an advertising partner today!

Using XHTML Section Headers

XHTML provides six built-in levels of headers (headings) to help you organize and layout the contents of your Web page in a structured manner. Here is an example of using XHTML headers:

Code Sample:
<h1>The 2004 Baseball ALCS Players Roster</h1>
    <h2>Boston RedSox</h2>
        <h3>Bronson Arroyo</h3>
        <h3>Tim Wakefield</h3>
        ...
    <h2>New York Yankees</h2>
        <h3>Derek Jeter</h3>
        <h3>Alex Rodriguez</h3>
        ...
view code in new window.
render sample in browser.
Download code sample on your computer.

To organize your Web page using XHTML section headers:

  • In the body of your XHTML document, go to where you wish to place the section header and type "<hn>", where n is a number between 1 and 6, which corresponds to the level of the header that you wish to create, for example: <h1>, <h2>, <h3>, <h4>, <h5>, <h6>
  • Type the contents of your header.
  • Type "</hn>" to close the section header, where n corresponds to the same number used in the first step.

Here's what the above XHTML section header example looks like when rendered in a browser:

Code Sample — browser view

XHTML Headers: Tips and Tricks

  • The higher the level of a header (i.e. the smaller the number), the more prominently they are displayed on the page. Typically, browsers default to Times New Roman, bold face, at 24, 18, 14, 12, 10 and 8 pixel font, respectively - you can always use a css stylesheet to override these default settings.
  • Headers are hierarchical - they give your document structure, like a table of contents. You can nest them, with bigger headings on the outside, and smaller headings on the inside.
  • XHTML headings are block-level elements - i.e., their contents automatically start on a new line.
Start Of Section: XHTML Tutorial Start of Section:
XHTML Tutorial
Previous Page: XHTML Namespace Previous Page:
XHTML Namespace
Next Page:
XHTML Images
Next Page: XHTML Images
Valid XHTML 1.0! Valid CSS! Site Map | Privacy Policy | Terms of Use | WebHeadStart.org © 2005 All Rights Reserved.