Webpage Workshop: Home » XHTML » Ordered lists

Ordered lists

The first type of list that we will discuss is the ordered list. This type of list is used to list items in some sort of numerical or alphabetical order and is suitable for creating step-by-step instructions or listing items in order of importance. The basic syntax for the ordered list is shown in the example below:

<ol>
  <li>Item 1</li>
  <li>Item 2</li>
</ol>

The example above makes a list with two items in it. Most browsers will show the items labelled with numbers, but this can be changed using Cascading Stylesheets. Lists can also be contain sublists, and the example below explains how this is done:

<ol>
  <li>Item 1
    <ol>
      <li>Sublist item 1</li>
      <li>Sublist item 2</li>
    </ol>
  </li>
  <li>Item 2</li>
</ol>

In the above example, the first list will normally be displayed using numbers, and the sublist will normally be labelled with lowercase letters. If you have even more sublists as children of the first sublist the labelling will be different again. Labels can take on the form of numbers (1, 2, 3, 4, 5), lowercase letters (a, b, c, d, e), uppercase letters (A, B, C, D, E), lowercase Roman numerals (i, ii, iii, iv, v) and finally uppercase Roman numerals (I, II, III, IV, V).

In the next tutorial we will discuss the other type of list; the unordered list.

<< Previous page | Next page >>