HTML <ol>Tag
Examples
2 different ordered list examples:
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
<ol start="50">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Try it Yourself »
Browser Support
| Element | |||||
|---|---|---|---|---|---|
| <ol> | Yes | Yes | Yes | Yes | Yes |
Definition and Usage
The <ol> tag defines an ordered list. The list is displayed with numbers.
Use<li>the <li> tag to define list items.
Tips and Notes
Note:You can use CSS to render it. For details, seeCSS Lists。
Note:For unordered lists, use the<ul><ul> tag.
Differences between HTML 4.01 and HTML5
The "reversed" attribute is new in HTML5.
In HTML 4.01, the "compact" attribute is deprecated and is not supported in HTML5.
Attributes
New: New in HTML5.
| Attribute | Value | Description |
|---|---|---|
| compact | compact | Not supported in HTML5. Deprecated.Use styles instead. Specifies that the list appears more compact than normal. |
| reversedNew | reversed | Specifies that the list is in descending order (9,8,7...) |
| start | number | An integer value attribute that specifies the start value of the list numbering.This attribute was deprecated in HTML4, but reintroduced in HTML5. |
| type |
|
Specifies the type of the list. Deprecated. Use styles instead. |
More Examples
Example
Set different list styles (using CSS):
<ol style="list-style-type:upper-roman">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
<ol style="list-style-type:lower-alpha">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Try it Yourself »
Example
Use CSS to display different list styles:
ol.a {list-style-type: armenian;}
ol.b {list-style-type: cjk-ideographic;}
ol.c {list-style-type: decimal;}
ol.d {list-style-type: decimal-leading-zero;}
ol.e {list-style-type: georgian;}
ol.f {list-style-type: hebrew;}
ol.g {list-style-type: hiragana;}
ol.h {list-style-type: hiragana-iroha;}
ol.i {list-style-type: katakana;}
ol.j {list-style-type: katakana-iroha;}
ol.k {list-style-type: lower-alpha;}
ol.l {list-style-type: lower-greek;}
ol.m {list-style-type: lower-latin;}
ol.n {list-style-type: lower-roman;}
ol.o {list-style-type: upper-alpha;}
ol.p {list-style-type: upper-latin;}
ol.q {list-style-type: upper-roman;}
ol.r {list-style-type: none;}
ol.s {list-style-type: inherit;}
Try it Yourself »
Example
Nested lists:
<ol>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ol>
Try it Yourself »
Global Attributes
The <ol> tag supports global attributes. View the full attribute tableHTML Global Attributes。
Event Attributes
The <ol> tag supports allHTML Event Attributes。
Related Articles
HTML Tutorial:HTML Lists
Other Extensions