Home HTML Guides Sitebuilder Q & A Resources Forum
J-ROBINSON.co.uk
HTML Central Amazon.co.uk - the widest choice of software at great prices


HTML GuidesNumbered Lists

There are virtually no differences between numbered and unordered lists. In fact, the only differene is one letter.

Yup, to make the bullet point list into a numbered list, just change UL to OL. Nothing else - honest!

<OL>
<LI>List Item 1</LI>
<LI>List Item 2</LI>
<LI>List Item 3</LI>
<LI>List Item 4</LI>
</OL>

  1. List Item 1
  2. List Item 2
  3. List Item 3
  4. List Item 4

Fun with Numbered Lists

Where numbered lists differ from their unnumbered friends is that they're much more tweakable a technical term, by the way). For example, say you want to start your list at a number other than 1. Just use the START attribute of OL with the number to start from:

<OL START="5">
<LI>List Item 1</LI>
<LI>List Item 2</LI>
<LI>List Item 3</LI>
<LI>List Item 4</LI>
</OL>

  1. List Item 1
  2. List Item 2
  3. List Item 3
  4. List Item 4

You can also skip out some numbers partway through the list if you need to by putting the VALUE attribute in one of your LI tags:

<OL START="5">
<LI>List Item 1</LI>
<LI>List Item 2</LI>
<LI VALUE="10">List Item 3</LI>
<LI>List Item 4</LI>
</OL>

  1. List Item 1
  2. List Item 2
  3. List Item 3
  4. List Item 4

At the moment you may not see why you'd ever want to mess with the numbering like this, but it could be very useful sometime (especially when you start using nested lists).

You can also change the way the list appears - instead of numbers you can have letters or Roman numerals (capital or lower case). This is controlled with the TYPE attribute of the OL tag - the possible values are "a", "A", "i", "I" and "1" (the default).

<OL TYPE="a">
<LI>List Item 1</LI>
<LI>List Item 2</LI>
<LI>List Item 3</LI>
<LI>List Item 4</LI>
</OL>

  1. List Item 1
  2. List Item 2
  3. List Item 3
  4. List Item 4

Nested Numbered Lists

These work in exactly the same way as nested unnumbered lists, as explained on the previous page. Here's where that number nobbling might become useful:

<OL TYPE="A">
<LI>List Item 1</LI>
<LI>List Item 2</LI>

<P></P>

<OL START="3" TYPE="a">
<LI>List Item 1</LI>
<LI>List Item 2</LI>
<LI>List Item 3</LI>
<LI>List Item 4</LI>
</OL>

<P></P>

<LI VALUE="7">List Item 3</LI>
<LI>List Item 4</LI>
</OL>

  1. List Item 1
  2. List Item 2
    1. List Item 1
    2. List Item 2
    3. List Item 3
    4. List Item 4

  3. List Item 3
  4. List Item 4

Before we leave lists completely, have a quick read about definition lists - they're just as easy, but no quite so common...

HTML Central Home
    HTML Guides
        Lists

< 1 | 2 | 3 >

Search:
 
Search facility provided by Atomz.com.
HTML Guides: Click here for HTML Guides index.

HTML Central Home
    HTML Guides
        Lists

< 1 | 2 | 3 >

Navigation Bar
Please send any comments, questions or complaints via this form
HTML Central is part of j-robinson.co.uk
© James Robinson 2001

Valid HTML! Valid CSS! Labelled with ICRA