The HTML <ol> tag

Definition and Usage

<ol> The tag defines an ordered list. An ordered list can be numeric or alphabetical.

<li> The tag is used to define each list item.

Tip:Use CSS to set the list style.

Tip:For unordered lists, use <ul> Tag.

See also:

HTML Tutorial:HTML Lists

HTML DOM Reference Manual:Ol Object

CSS Tutorial:Set the style of the list

Instance

Example 1

Two different ordered lists (the first list starts from 1, the second from 50):

<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

Example 2

Set different list types (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 3

Display all available different list types using CSS:

<style>
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;}
</style>

Try It Yourself

Example 4

Reduce and enlarge the line height in the list (using CSS):

<ol style="line-height:80%">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>
<ol style="line-height:180%">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

Try It Yourself

Example 5

Nested unordered list within an ordered list:

<ol>
  <li>Coffee</li>
  <li>Tea</li>
    <ul>
      <li>Longjing</li>
      <li>Pu'er</li>
    </ul>
  </li>
  <li>Milk</li>
</ol>

Try It Yourself

Attribute

Attribute Value Description
reversed reversed Define that the list order should be reversed (9, 8, 7 ...).
start Number Define the starting value of an ordered list.
type
  • 1
  • A
  • a
  • I
  • i
Specifies the type of marker to be used in the list.

Global Attributes

<ol> The tag also supports Global Attributes in HTML.

Event Attributes

<ol> The tag also supports Event Attributes in HTML.

Default CSS Settings

Most browsers will use the following default values to display <ol> Element:

ol {
  display: block;
  list-style-type: decimal;
  margin-top: 1em;
  margin-bottom: 1em;
  margin-left: 0;
  margin-right: 0;
  padding-left: 40px;
}

Try It Yourself

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support