Team LiB
Previous Section Next Section

Working with Lists

To add a list to an HTML page, use the <ul> tag for unordered (bulleted) lists or the <ol> tag for ordered (numbered) lists, with the <li> tags for list items. Here is an example (see Figure 21-5):

<html>
      <head>
              <title> This is a basic Web Page! </title>
      </head>
      <body>
              <ul>
                  <li>Queen</li>
                  <li>Genisis</li>
                  <li>Van Halen</li>
              </ul>
              <ol>
                  <li>Queen</li>
                  <li>Genisis</li>
                  <li>Van Halen</li>
              </ol>
              <dl>
                  <dt> Rock </dt>
                  <dd>Great Music!</dd>
              </dl>
      </body>
</html>
Click To expand
Figure 21-5: Lists added to an HTML page

With unordered lists, you can use the type attribute to describe what your bullets look like. The valid values are disc, circle, and square.

With numbered lists, the type attribute controls the numbering. The valid possibilities are as follows:

   1, which displays 1, 2, 3, 4, 5, and so on
   A, which displays A, B, C, D, E, and so on
   a, which displays a, b, c, d, e, and so on
   I, which displays I, II, III, IV, V, and so on
   i, which displays i, ii, iii, iv, v, and so on

You can also use the start attribute to control the number with which to start the numbered list. For example, the following starts the list with the letter F:

<ol type="A" start="5"/>

Team LiB
Previous Section Next Section