www.gibmonks.com

Main Page




Previous Page
Next Page

[Page 1330]

J.4. Headers

Some text in an XHTML document might be more important than other text. For example, the text in this section is considered more important than a footnote. XHTML provides six headers, called header elements, for specifying the relative importance of information. Figure J.2 demonstrates these elements (h1 through h6).

Figure J.2. Header elements h1 tHRough H6.

 1  <?xml version = "1.0"?>
 2  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 3     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 4
 5  <!-- Fig. J.2: header.html -->
 6  <!-- XHTML headers.        -->
 7
 8  <html xmlns = "http://www.w3.org/1999/xhtml">
 9     <head>
10        <title>XHTML headers</title>
11     </head>
12
13     <body>
14
15        <h1>Level 1 Header</h1>
16        <h2>Level 2 header</h2>
17        <h3>Level 3 header</h3>
18        <h4>Level 4 header</h4>
19        <h5>Level 5 header</h5>
20        <h6>Level 6 header</h6>
21
22     </body>
23  </html>


[Page 1331]

Header element h1 (line 15) is considered the most significant header and is rendered in a larger font than the other five headers (lines 1620). Each successive header element (i.e., H2, h3, etc.) is rendered in a smaller font.

Portability Tip J.1

The text size used to display each header element can vary significantly between browsers.


Look-and-Feel Observation J.1

Placing a header at the top of every XHTML page helps viewers understand the purpose of each page.


Look-and-Feel Observation J.2

Use larger headers to emphasize more important sections of a Web page.



Previous Page
Next Page