In contrast with the UL element, the items are numbered (consecutively by default).
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:
Type | Numbering style | The first few numbers |
---|---|---|
1 | normal (Arabic) numbers | 1, 2, 3, ... |
a | Latin letters in lowercase | a, b, c, ... |
A | Latin letters in uppercase | A, B, C, ... |
i | Roman numbers in lowercase | i, ii, iii, ... |
I | Roman numbers in uppercase | I, II, III, ... |
<P> Proceed as follows: </P> <OL> <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. </OL>An example where it is natural to use Roman numbers:
<P> The declinations of nouns in Latin are best distinguished by the ending of the genitive singular: </P> <OL TYPE=I> <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>. </OL>A contrived example to show the effects of attributes and overriding them in LI elements.
<OL TYPE=a START=3 COMPACT> <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. </OL>See also Examples of various list elements in HTML.
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.