HTML <ol> tag
When writing in HTML (hypertext markup language), the <ol> tag is a block element used to designate an ordered list. It is useful for creating lists that are either numbered or alphabetical. The following sections contain information about the <ol> tag, including an example of it in use, and related attributes and browser compatibility.
If you wanted to create a bullet list or unordered list, use the <ul> tag.
Example of <ol> code
<h3>Ordered list</h3> <ol>
<li>First numbered item</li>
<li>Second numbered item</li>
<li>Third numbered item</li>
</ol>
<h3>Start at number 5</h3> <ol start="5">
<li>Fifth numbered item</li>
<li>Sixth numbered item</li>
<li>Seventh numbered item</li>
</ol>
Each number is created using the <li> tag, which designates a list item.
Example result
Ordered list
- First numbered item
- Second numbered item
- Third numbered item
Start at number 5
- Fifth numbered item
- Sixth numbered item
- Seventh numbered item
Attributes
All HTML tags support standard attributes that define the settings of an HTML element. In addition to the standard settings, the <ol> tag has the following unique attributes.
Attribute | Description |
---|---|
reversed | Designates that a list should go in descending order. |
start | Designates the start value of an ordered list. |
type | Designates the type of markers to use in a list. |
Deprecated attributes
In addition to the above attributes, the <ol> tag had the following deprecated attributes.
Attribute | Description |
---|---|
compact | Designates that the list should appear smaller. |
Compatibility
Edge | Internet Explorer | Firefox | Safari | Opera | Chrome |
---|---|---|---|---|---|
All versions | All versions | All versions | All version | All versions | All versions |
Browser, Compatibility, Container tag, HTML li tag, HTML ul tag, List, Web design terms