HTML » Tags » ol

Version: 2.0, 3.2, 4.0

Compability: Explorer 4, 5  Netscape 4, 6

Syntax:
<ol>... </ol>

The <ol> tag is used to delimit the start and stop of an ordered list. An ordered list is a collection of items (typically related somehow) that need to be listed in particular order. For example, an ordered list could be an index, table of contents, or a set of instructions. The default is to list each item in numeric order (starting with the number 1). However, you can also specify Roman numerals or alphabetic characters.

Most browsers separate the list from any preceding and following text by paragraph breaks. You can nest ordered lists and the nested lists will also be in ordered value.
 
You must use the li tag to display an item in the list.
 
You can use the ul tag to create an unordered list and the dl tag to create a definition list. (The dir and menu list tags are deprecated.)
 
The closing tag is mandatory.
 

Examples

Code:
Three Major Types Of Lists:
<ol>
<li> Definition List
<ol type="A" start="5">
<li> dd tag
<li> dl tag
<li> dt tag
</ol>
<li> Ordered List
<ol type="i">
<li> ol tag
<li> li tag
</ol>
<li> Unordered List
<ol type="1">
<li> ul tag
<li> li tag
</ol>
</ol>
Output:
Three Major Types Of Lists:
  1. Definition List
    1. dd tag
    2. dl tag
    3. dt tag
  2. Ordered List
    1. ol tag
    2. li tag
  3. Unordered List
    1. ul tag
    2. li tag
Explanation:

The preceding example shows the use of the <ol> tag to produce an ordered list. For examples of unordered and definition lists please see the respective pages.

Language(s): HTML

See Also: