<ol> (Ordered List)
This element is used to define an ordered or numbered list of items. The numbering style comes in many forms, including letters, Roman numerals, and regular numerals. The individual items within the list are specified by li elements included with the ol element.
Standard Syntax
<ol
class="class name(s)"</ol>
compact="compact" (transitional only)
dir="ltr | rtl"
id="unique alphanumeric identifier"
lang="language code"
start="number" (transitional only)
style="style information"
title="advisory text"
type="a | A | i | I | 1"> (transitional only)
li elements only
Attributes Defined by Internet Explorer
accesskey="key"(5.5)
contenteditable="false | true | inherit"(5.5)
disabled="false | true"(5.5)
hidefocus="true | false"(5.5)
language="javascript | jscript | vbs | vbscript"(4)
tabindex=""number (5.5)
unselectable="on | off"(5.5)
Standard Event Attributes
onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup
Events Defined by Internet Explorer
onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlayoutcomplete, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror
Element Specific Attributes
- compact
- This attribute indicates that the list should be rendered in a compact style. Few browsers actually change the rendering of the list regardless of the presence of this attribute. The compact attribute requires no value under traditional HTML, but under XHTML should be set to compact.
- start
- This attribute specifies the start value for numbering the individual list items. Although the ordering type of list elements might be Roman numerals, such as XXXI, or letters, the value of start is always represented as a number. To start numbering elements from the letter "C," use <ol type="A" start="3">.
- type
- This attribute indicates the numbering type: a indicates lowercase letters, A indicates uppercase letters, i indicates lowercase Roman numerals, I indicates uppercase Roman numerals, and 1 indicates numbers. Type set in an ol element is used for the entire list unless a type attribute is used within an enclosed li element.
Examples
<ol type="1">
<li>First step</li>
<li>Second step</li>
<li>Third step</li>
</ol>
<ol compact type="I" start="30">
<li>Clause 30</li>
<li>Clause 31</li>
<li>Clause 32</li>
</ol>
Compatibility
HTML 2, 3.2, 4, 4.01
XHTML 1.0, 1.1, Basic
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5 4.8, 6, 7
Opera 4-7
Notes
Under the strict HTML and XHTML specifications, the ol element no longer supports the compact, start, and type attributes. These aspects of lists can be controlled with style sheet rules.
Under the XHTML 1.0 specification, the compact attribute no longer can be minimized, but must have a quoted attribute value: <ol compact="compact">.
The HTML 3.2 specification supports only the compact, start, and type attributes.
The HTML 2.0 specification supports only the compact attribute.