HTML5 Reference

HTML <ol> tag

Definition

The <ol> tag and it's closing </ol> tag defines an ordered list.

Example


<ol>
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
  <li>Four</li>
</ol>
  1. One
  2. Two
  3. Three
  4. Four

Attributes

The following attributes can be used with the <ol> tag.


<ol> Specific Attributes
Attribute Value Description Example
reversedempty string or reversedSpecifies that this a reversed order (descending) list.

<ol reversed>Ordered List</ol>
<ol reversed="reversed">Ordered List</ol>
startordinal numberSpecifies the first number in the list.

<ol start="17">Ordered List</ol>
typeordinal numberSpecifies the marker type for the list.

Valid values:

Decimal numbers: 1 (default)

Alphabetically, lowercase: a

Alphabetically, uppercase: A

Roman numerals, lowercase: i

Roman numerals, uppercase: I

In almost all cases using the CSS list-style-type property is more appropriate for specifying marker types.

<ol type="a">Ordered List</ol>
<ol type="A">Ordered List</ol>
<ol type="i">Ordered List</ol>
<ol type="I">Ordered List</ol>
<ol> Global Attributes
Attribute Description Example
Common
classSpecifies a classname for the element allowing you to apply the style of the predefined class to the content.

<ol class="name">Ordered List</ol>
idSpecifies a unique id for the element allowing you to apply the style of the predefined id to the content.

<ol id="name">Ordered List</ol>
styleSpecifies an inline style for the element allowing you to apply the style to the contentt.

<ol style="color:red;">Ordered List</ol>
titleSpecifies an inline style for the element allowing you to apply the style to the content.

<ol title="Content info">Ordered List</ol>
Keyboard
accesskeySpecifies a keyboard shortcut to associate with the element.

<ol accesskey="a">Ordered List</ol>
tabindexSpecifies a tab order for the element.

<ol tabindex="1">Ordered List</ol>
Language
dirSpecifies the directional flow of the content.

<!-- The text will flow from left to right -->
<ol dir="ltr">Ordered List</ol>
<!-- The text will flow from right to left -->
<ol dir="rtl">Ordered List</ol>
langSpecifies a language code for the content of the element.

<ol lang="en">Ordered List</ol>
spellcheckSpecifies an inline style for the element allowing you to apply the style to the contentt.

<!-- Valid values true and false. -->
<!-- Default inherited / browser specific. -->
<ol spellcheck="true">Ordered List</ol> 
translateSpecifies an inline style for the element allowing you to apply the style to the content.

<!-- Valid values yes and no. -->
<!-- Default yes. -->
<ol translate="no">Ordered List</ol> 
Miscellaneous
contenteditableSpecifies whether the content of the element is editable.

<!-- Valid values true and false. -->
<!-- Default inherited. -->
<ol contenteditable="true">Ordered List</ol> 
draggableSpecifies whether the element is draggable.

<!-- Valid values true and false. -->
<!-- Default browser specific. -->
<ol draggable="true">Ordered List</ol>
hiddenSpecifies whether the element is not yet, or no longer, relevant.

<!-- Valid values an empty string or hidden -->
<ol hidden>Ordered List</ol> 
<ol hidden="hidden">Ordered List</ol> 
<ol> Event Attributes
Attribute Description Example
Document Element
oncopyThe script to be run when the user copies the content of an element.

 <!-- Executes go() function -->
<ol oncopy="go()">Ordered List</ol> 
oncutThe script to be run when the user cuts the content of an element.

 <!-- Executes go() function -->
<ol oncut="go()">Ordered List</ol>
onpasteThe script to be run when the user pastes some content into an element.

 <!-- Executes go() function -->
<ol onpaste="go()">Ordered List</ol>
Drag and Drop
ondragThe script to be run when an element is dragged.

 <!-- Executes go() function -->
<ol ondrag="go()">Ordered List</ol>
ondragendThe script to be run when an element has stopped being dragged.

 <!-- Executes go() function -->
<ol ondragend="go()">Ordered List</ol>
ondragenterThe script to be run when an element has been dragged to a valid drop target.

 <!-- Executes go() function -->
<ol ondragenter="go()">Ordered List</ol>
ondragleaveThe script to be run when an element leaves a valid drop target.

 <!-- Executes go() function -->
<ol ondragleave="go()">Ordered List</ol>
ondragoverThe script to be run when an element is being dragged over a valid drop target.

 <!-- Executes go() function -->
<ol ondragover="go()">Ordered List</ol>
ondragstartThe script to be run at the start of a drag operation.

 <!-- Executes go() function -->
<ol ondragstart="go()">Ordered List</ol>
ondropThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<ol ondrop="go()">Ordered List</ol>
Form
onblurThe script to be run when the element loses focus.

 <!-- Executes go() function -->
<ol onblur="go()">Ordered List</ol>
onchangeThe script to be run when object changed and attempt to leave field.

 <!-- Executes go() function -->
<ol onchange="go()">Ordered List</ol>
oncontextmenuThe script to be run when a context menu is triggered.

 <!-- Executes go() function -->
<ol oncontextmenu="go()">Ordered List</ol>
onfocusThe script to be run when the element gets focus.

 <!-- Executes go() function -->
<ol onfocus="go()">Ordered List</ol>
oninputThe script to be run when an element gets user input.

 <!-- Executes go() function -->
<ol oninput="go()">Ordered List</ol>
oninvalidThe script to be run when an element is invalid.

 <!-- Executes go() function -->
<ol oninvalid="go()">Ordered List</ol>
onresetThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<ol onreset="go()">Ordered List</ol>
onselectThe script to be run when some or all of the contents of an object are selected.

 <!-- Executes go() function -->
<ol onselect="go()">Ordered List</ol>
onsubmitThe script to be run when a form is submitted.

 <!-- Executes go() function -->
<ol onsubmit="go()">Ordered List</ol>
Keyboard
onkeydownThe script to be run when an element is in focus and keyboard key is pressed down.

 <!-- Executes go() function -->
<ol onkeydown="go()">Ordered List</ol>
onkeypressThe script to be run when an element is in focus and keyboard key is pressed down and released.

 <!-- Executes go() function -->
<ol onkeypress="go()">Ordered List</ol>
onkeyupThe script to be run when an element is in focus and keyboard key is released.

 <!-- Executes go() function -->
<ol onkeyup="go()">Ordered List</ol>
Media
onabortThe script code to be run on abort.

 <!-- Executes go() function -->
<ol onabort="go()">Ordered List</ol>
oncanplayThe script to be run when a file has buffered enough so it is ready to start playing.

 <!-- Executes go() function -->
<ol oncanplay="go()">Ordered List</ol>
oncanplaythroughThe script to be run when a file can be played all the way to the end without further need of buffering.

 <!-- Executes go() function -->
<ol oncanplaythrough="go()">Ordered List</ol>
oncuechangeThe script to be run when the cue changes when using the track element.

 <!-- Executes go() function -->
<ol oncuechange="go()">Ordered List</ol>
ondurationchangeThe script to be run when the length of the media is changed.

 <!-- Executes go() function -->
<ol ondurationchange="go()">Ordered List</ol>
onemptiedThe script to be run when a media resource element suddenly becomes empty, usually due to an error.

 <!-- Executes go() function -->
<ol onemptied="go()">Ordered List</ol>
onendedThe script to be run when the media has reach the end.

 <!-- Executes go() function -->
<ol onended="go()">Ordered List</ol>
onloadeddataThe script to be run when media data is loaded and playback can start.

 <!-- Executes go() function -->
<ol onloadeddata="go()">Ordered List</ol>
onloadedmetadataThe script to be run when metadata has been loaded.

 <!-- Executes go() function -->
<ol onloadedmetadata="go()">Ordered List</ol>
onloadstartThe script to be run whenthe media resource has started loading.

 <!-- Executes go() function -->
<ol onloadstart="go()">Ordered List</ol>
onpauseThe script to be run when the media resource has been paused.

 <!-- Executes go() function -->
<ol onpause="go()">Ordered List</ol>
onplayThe script to be run when the media resource starts playback.

 <!-- Executes go() function -->
<ol onplay="go()">Ordered List</ol>
onplayingThe script to be run when when playback has already begun.

 <!-- Executes go() function -->
<ol onplaying="go()">Ordered List</ol>
onprogressThe script to be run when the browser is fetching the media data.

 <!-- Executes go() function -->
<ol onprogress="go()">Ordered List</ol>
onratechangeThe script to be run when the playback rate changes.

 <!-- Executes go() function -->
<ol onratechange="go()">Ordered List</ol>
onseekedThe script to be run when the seeking attribute is set to false indicating that seeking has finished.

 <!-- Executes go() function -->
<ol onseeked="go()">Ordered List</ol>
onseekingThe script to be run when the seeking attribute is set to true indicating that seeking is currently active.

 <!-- Executes go() function -->
<ol onseeking="go()">Ordered List</ol>
onstalledThe script to be run when the browser is unable to continue fetching media data.

 <!-- Executes go() function -->
<ol onstalled="go()">Ordered List</ol>
onsuspendThe script to be run when media data has stopped before being completely loaded.

 <!-- Executes go() function -->
<ol onsuspend="go()">Ordered List</ol>
ontimeupdateThe script to be run when the media resources current playback position has changed.

 <!-- Executes go() function -->
<ol ontimeupdate="go()">Ordered List</ol>
onvolumechangeThe script to be run when the volume has changed or been muted.

 <!-- Executes go() function -->
<ol onvolumechange="go()">Ordered List</ol>
onwaitingThe script to be run when the media resource has paused but is expected to resume.

 <!-- Executes go() function -->
<ol onwaiting="go()">Ordered List</ol>
Mouse
onclickThe script to be run when when a mouse is clicked on an element.

 <!-- Executes go() function -->
<ol onclick="go()">Ordered List</ol>
ondblclickThe script to be run when a mouse is double clicked on an element.

 <!-- Executes go() function -->
<ol ondblclick="go()">Ordered List</ol>
onmousedownThe script to be run when he mouse button is pressed down while the cursor is over an element.

 <!-- Executes go() function -->
<ol onmousedown="go()">Ordered List</ol>
onmousemoveThe script to be run when the mouse button is moved.

 <!-- Executes go() function -->
<ol onmousemove="go()">Ordered List</ol>
onmouseoutThe script to be run when the mouse cursor moves off an element.

 <!-- Executes go() function -->
<ol onmouseout="go()">Ordered List</ol>>
onmouseoverThe script to be run when the mouse cursor moves over an element.

 <!-- Executes go() function -->
<ol onmouseover="go()">Ordered List</ol>
onmouseupThe script to be run when the mouse button is released while the cursor is over the element.

 <!-- Executes go() function -->
<ol onmouseup="go()">Ordered List</ol>
onwheelThe script to be run when the mouse wheel rolls up or down over an element.

 <!-- Executes go() function -->
<ol onwheel="go()">Ordered List</ol>
Scroll
onscrollThe script code to be run when the scrollbar of an element is being scrolled.

 <!-- Executes go() function -->
<ol onscroll="go()">Ordered List</ol> 
Window - NONE