ptg16476052
62 LESSON 4: Learning the Basics of HTML
Headings
Headings are used to add titles to sections of a page. HTML defines six levels of head-
ings. Heading tags look like the following:
<h1>Installing Your Safetee Lock</h1>
The numbers indicate heading levels (h1 through h6). The headings, when they’re dis-
played, aren’t numbered. They’re displayed in larger and bolder text so that they stand
out from regular text.
Think of the headings as items in an outline. If the text you’re writing is structured, use
the headings to express that structure, as shown in the following code:
<h1>Movies</h1>
<h2>Action/Adventure</h2>
<h3>Caper</h3>
<h3>Sports</h3>
<h3>Thriller</h3>
<h3>War</h3>
<h2>Comedy</h2>
<h3>Romantic Comedy</h3>
<h3>Slapstick</h3>
<h2>Drama</h2>
<h3>Buddy Movies</h3>
<h3>Mystery</h3>
<h3>Romance</h3>
<h2>Horror</h2>
Notice that I’ve indented the headings in this example to better show the hierarchy. They
don’t have to be indented in your page; in fact, the browser ignores the indenting.
Even though the browser ignores any indenting you include in your
code, you will probably find it useful to indent your code so that
it’s easier to read. You’ll find that any lengthy examples in this
book are indented for that reason, and you’ll probably want to
carry that convention over to your own HTML code.
TIP
Unlike titles, headings can be any length, spanning many lines of text. Because headings
are emphasized, however, having many lines of emphasized text might be tiring to read.
A common practice is to use a first-level heading at the top of your page to either dupli-
cate the title or to provide a shorter or less context-specific form of the title. If you have a