HTML <ol>
Tag
Topic: HTML5 Tags ReferencePrev|Next
Description
The <ol>
(short for ordered list) tag defines an ordered list of items. Each list item is defined by a <li>
tag. Typically, ordered-list items are displayed with a number in front of it, but the numbering style can be controlled with the CSS list-style-type
property.
The following table summarizes the usages context and the version history of this tag.
Placement: | Block |
---|---|
Content: | One or more <li> elements |
Start/End Tag: | Start tag: required, End tag: required |
Version: | HTML 2, 3.2, 4, 4.01, 5 |
Syntax
The basic syntax of the <ol>
tag is given with:
The example below shows the <ol>
tag in action.
Example
Try this code »<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
Tag-Specific Attributes
The following table shows the attributes that are specific to the <ol>
tag.
Attribute | Value | Description |
---|---|---|
reversed |
reversed |
This Boolean attribute specifies that the items of the list are specified in the reverse order. |
type |
1 |
Specify the bullet or numbering type for the list item. |
compact |
compact |
Obsolete This Boolean attribute specifies that the list should be rendered in a compact style. |
start |
number | Specifies the starting number of the first item in an ordered list. |
Note: The attributes 'start
' and 'type
' of the <ol>
element was deprecated in previous version of HTML, but reintroduced in HTML5.
Global Attributes
Like all other HTML tags, the <ol>
tag supports the global attributes in HTML5.
Event Attributes
The <ol>
tag also supports the event attributes in HTML5.
Browser Compatibility
The <ol>
tag is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: HTML Lists.