Code has been added to clipboard!

HTML Ordered List

Reading time 2 min
Published Jun 29, 2017
Updated Oct 2, 2019

HTML Ordered List: Main Tips

  • Using <ol> tags, you can create HTML ordered lists of items.
  • The <li> elements that are descendants of <ol> define list items.
  • To create unordered lists, use <ul> tag.
  • HTML ol tag supports all global attributes.

Using ol Tags

By using HTML ol tags in a document, you can create HTML numbered lists:

Example
<ol>
  <li>Action</li>
  <li>Adventure</li>
  <li>Thriller</li>
  <li>Comedy</li>
</ol>

HTML ordered lists can also be nested:

Example
<ol>
<li>Coffee</li>
<li>Breakfast
<ol>
  <li>Eggs</li>
  <li>Bacon</li>
  <li>Toast</li>
</ol>
</li>
<li>Cake</li>
</ol>

Mostly Used ol Tag Attributes

The type attribute defines the type of numbering to use:

Value Description
1 Numbers (default value)
I Uppercase Roman numerals
i Lowercase Roman numerals
A Uppercase letters
a Lowercase letters
Example
<ol type="I">
  <li>Burger</li>
  <li>Pizza</li>
  <li>Sandwich</li>
</ol>

HTML numbered list starts from number 1 by default. To change that, you can use the start attribute. It defines a start value for numbering the HTML ordered list. start should always be defined in a number, no matter the chosen numbering type:

Example
<ol start="11">
  <li>Eleven</li>
  <li>Twelve</li>
  <li>Thirteen</li>
</ol>

Note: both start and type have been deprecated in HTML4 and reintroduced again in HTML5.

Newly introduced in HTML5, the reversed attribute sets the ordering of the list to descending:

Example
<ol reversed>
  <li>Apple</li>
  <li>Orange</li>
  <li>Mango</li>
</ol>

compact rendered the list in a compact style. However, it has been deprecated in HTML5 and should not be used:

Example
<ol compact>
  <li>Action</li>
  <li>Adventure</li>
  <li>Thriller</li>
</ol>

Tip: instead of compact, use CSS line-height property. A value of 80% will give a very similar effect.

Browser support

Chrome
All
Edge
All
Firefox
1+
IE
All
Opera
All
Safari
All

Mobile browser support

Chrome
All
Firefox
4+
Opera
All
Safari
All
Basics
Introduction
Syntax
Editors
Basic Examples
Head Section
<!DOCTYPE>
Tags and Elements
Semantic Elements
Tags Reference
Attributes
Comments
Block and Inline Elements
Forms
Form Elements
Input
Responsive Web Design
Inline Scripts
Uniform Resource Locator
Redirect
XHTML
Geolocation
Drag and Drop
Local Storage
Web Workers
Server-Sent Events
Character Encoding
Text Formatting
Quotation and Citation Elements
Headings
Paragraphs
Links
Tables
Lists
Symbols
Space
Tab
Styles
Computer Code
Layout
Classes
Colors
Images
iframes
Audio Player
Video Player
YouTube Videos
Multimedia
Canvas
SVG
<!-- -->
<a>
<abbr>
<acronym> DEPRECATED
<address>
<applet> DEPRECATED
<article>
<aside>
<audio>
<b>
<base>
<basefont> DEPRECATED
<bdi>
<bdo>
<big> DEPRECATED
<blink> DEPRECATED
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<center> DEPRECATED
<cite>
<code>
<col>
<colgroup>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<dir> DEPRECATED
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<font> DEPRECATED
<footer>
<form>
<frame> DEPRECATED
<frameset> DEPRECATED
<h1> – <h6>
<head>
<header>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<keygen> DEPRECATED
<label>
<legend>
<li>
<link>
<main>
<map>
<mark>
<menu>
<menuitem> DEPRECATED
<meta>
<meter>
<nav>
<noframes> DEPRECATED
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike> DEPRECATED
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt> DEPRECATED
<u>
<ul>
<var>
<video>
<wbr>