<ol>

Defines an ordered list with HTML.
2 min read
Believemy logo

The <ol> tag is used in HTML to define an ordered list. It allows you to display a list in which the items are presented in a specific order (for example, numbered from 1 to n).

 

Structure and syntax of the <ol> tag

Basic structure and syntax

Here is the basic syntax of the <ol> tag:

HTML
<ol>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ol>

The <ol> tag is used to contain a series of list items. Each item in the list is defined using the <li> tag.

 

Usage example

Here is an example of using the <ol> tag for an ordered list:

HTML
<ol>
  <li>Start the project</li>
  <li>Analyze the needs</li>
  <li>Develop the code</li>
  <li>Test the application</li>
</ol>

In this example, each item in the list is automatically numbered by the browser.

 

Attributes

The <ol> tag can accept certain attributes to customize the display of the list:

  • type: Defines the type of numbering (for example, 1 for numbers, a for letters, etc.).
  • start: Specifies the starting number of the list. By default, the list starts at 1.

 

Example of attributes

HTML
<ol type="a" start="3">
  <li>Third item</li>
  <li>Fourth item</li>
</ol>

In this example, the list starts with the letter "c" (corresponding to 3) and uses letters to number the items.

 

Difference with other similar tags

  • <ul>: The <ul> tag is used for an unordered list, meaning the items are displayed without any specific order (usually with bullets).
  • <li>: The <li> tag is used to define the items in an ordered list (<ol>) or unordered list (<ul>).
  • <dl>: Finally, the <dl> tag is used to create definition lists exclusively.

 

Browser compatibility

The <ol> tag is supported by all modern browsers.

BrowserCompatibility
ChromeYes
FirefoxYes
SafariYes
EdgeYes
Internet ExplorerYes

Related terms

Discover our hTML and CSS glossary

Browse the terms and definitions most commonly used in HTML and CSS development.

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.