Learning HTML 3.2 by Examples, section 5 Descriptions of HTML 3.2 tags:

OL - ordered (numbered) list


To present information in the form of an ordered (numbered) list.

Typical rendering

The list items are presented separately, although possibly with less space between them than there is e.g. between paragraphs. The presentation is often indented in a manner which causes nested lists to be indented according to their structure.

In contrast with the UL element, the items are numbered (consecutively by default).

Basic syntax

<LI> list item 1
<LI> list item 2

Possible attributes

attribute name possible values meaning notes
TYPE 1, a, A, i, I numbering style case of letter is significant
START integer starting sequence number default is 1; especially non-positive values are inconsistently supported
COMPACT COMPACT reduced interim spacing often ignored by browsers

Attributes TYPE and START where not in HTML 2.0! All of the attributes are deprecated in HTML 4.0

The meanings of the values of TYPE are the following:

TypeNumbering styleThe first few numbers
1normal (Arabic) numbers1, 2, 3, ...
aLatin letters in lowercasea, b, c, ...
ALatin letters in uppercaseA, B, C, ...
iRoman numbers in lowercasei, ii, iii, ...
IRoman numbers in uppercaseI, II, III, ...

Allowed context

Block container.


LI elements (one or more).


A simple example:

Example OL-1.html:

Proceed as follows:
<LI> Try to guess how to use the program.
<LI> If it fails, send lots of questions to Usenet News.
<LI> If they flame you, consider contacting local user support.
<LI> When everything else fails, read the manuals.
An example where it is natural to use Roman numbers:

Example OL-2.html:

The declinations of nouns in Latin are best distinguished by
the ending of the genitive singular:
<LI> <I>-ae</I>, eg <I>terra:terrae</I>
<LI> <I>-i</I>, eg <I>annus:anni</I>
<LI> <I>-is</I>, eg <I>labor:laboris</I>
<LI> <I>-us</I>, eg <I>fructus:fructus</I>
<LI> <I>-ei</I>, eg <I>dies:diei</I>.
A contrived example to show the effects of attributes and overriding them in LI elements.

Example OL-3.html:

<LI> first item
<LI> second item
<LI VALUE=8> item after skipping a few values
<LI> next item
<LI TYPE=A> going on with uppercase
<LI> this is the last item.     
See also Examples of various list elements in HTML.


See general notes about list elements for a discussion of selecting between them. It is natural to use an ordered list if the order of the items should be emphasized, e.g. when they are instructions to be followed in that sequence, a description of events in their temporal order, or things in order of importance.

The sequence numbers of the items start from the value of the START attribute (by default 1). You can set it later on with the VALUE attribute on LI elements. Both of these attributes expect integer values. (Even if you have set the TYPE attribute to something else than 1, the values of the VALUE attribute must be specified using the normal notation of numbers as sequences of digits.) You can't indicate that numbering should be continued from a previous list or skip missing values without giving an explicit number.

The START attribute in OL, as well as the VALUE attribute in LI inside OL, is inconsistently supported by browsers. Most browsers support positive values, though e.g. Opera 4.0 doesn't do that properly (fixed in version 5.0). But although a few browsers support negative and zero values, popular browsers have problems in that area; some browsers even support negative and positive value but not zero (treating START="0" as START="1"). It is unlikely that you would like to use negative values, but starting numbering from zero is fairly common. The browser inconsistencies however imply that this is not a good idea. If it is essential to make numbering start from zero, consider using a UL so that the numbers are part of the textual content in LI elements.

The alignment of numbers is unspecified. In particular, Roman numbers might be left or right aligned or centered. (This is outside the control of the document author when using the OL element; you may wish to consider the alternative of using a table.)

In nested OL lists, it would be natural to use numbering of the form m.n but the specifications are silent about this. In practice, and most browsers use simple numbering which is independent of any nesting.

Date of last update: 2010-12-16.
This page belongs to the free information site IT and communication, section Web authoring and surfing, by Jukka "Yucca" Korpela.