Headings: <h1> Through <h6>You use the <h1> through <h6> elements to create headings in your documents. These are the familiar headings from HTML: <h1> creates the largest text and <h6> produces the smallest. These elements are supported in 1.0 Strict, 1.0 Transitional, 1.0 Frameset, and XHTML 1.1. Here are the possible attributes of these elements and which versions of XHTML support them:
These elements also support these events in XHTML: onclick , ondblclick , onmousedown , onmouseup , onmouseover , onmousemove , onmouseout , onkeypress , onkeydown , and onkeyup . Headings act much like headlines in newspapers. They are block elements that present text in bold and often are larger than other text. There are six heading tags: <h1> , <h2> , <h3> , <h4> , <h5> , and <h6> . <h1> creates the largest text, and <h6> creates the smallest. Because headings are block elements, they get their own line in a displayed XHTML document. Here's an example that shows these headings in action: Listing ch16_06.html<?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title> The <h1> - <h6> Elements </title> </head> <body> <center> <h1>This is an <h1> heading</h1> <h2>This is an <h2> heading</h2> <h3>This is an <h3> heading</h3> <h4>This is an <h4> heading</h4> <h5>This is an <h5> heading</h5> <h6>This is an <h6> heading</h6> </center> </body> </html> You can see this XHTML displayed in Netscape Navigator in Figure 16-4. Headings such as these help break up the text in a page, just as they do in newspapers, and they make the structure of your document stand out. Figure 16-4. Displaying the six levels of headings in Netscape Navigator.
|