- HTML Tutorial
- HTML Introduction
- HTML Editors
- HTML Basic
- HTML Comments
- HTML Elements
- HTML Attributes
- HTML Id & Classes
- HTML Skeletal Tags
- HTML Heading Tags
- HTML Paragraph Tag
- HTML Line Break Tag
- HTML Pre Tag
- HTML Anchor Tag
- HTML Image Tag
- HTML Horizontal Line Tag
- HTML Inline & Block
- HTML Inline
- HTML Block
- HTML LInks
- HTML Images
- HTML Formatting
- HTML Head
- HTML Head
- HTML Title
- HTML Meta Elements
- HTML Favicon
- HTML Style
- HTML List
- HTML Lists
- HTML Unordered List
- HTML Ordered List
- HTML Description List
- HTML Table
- HTML Tables
- HTML Table Headers
- HTML Table Styling
- HTML Table Colgroup
- HTML Form
- HTML Forms
- HTML Form Elements
- HTML Form Attributes
- HTML Input Types
- HTML Input Attributes
- HTML Form Actions
- HTML Semantic
- HTML Semantics
- HTML Graphics & Media
- HTML Canvas
- HTML SVG
- HTML Video & Audio
- HTML Plug-ins
- iFrames in HTML
- HTML Miscellaneous Tags
- HTML Code Tag
- HTML Entities
- HTML Quotation
- HTML Global Attributes
- HTML Obsolete Tags
- HTML Emojis
- HTML Symbols
- HTML Events
- HTML Colors
HTML Ordered List
An HTML ordered list (<ol>) is used to present a sequence of items in a specific order. Unlike unordered lists which use bullets, ordered lists use a numerical or alphabetical sequence to show a clear progression. Use these when the order of items is critical, such as in step-by-step instructions, recipes, or a "Top 10" ranking.
Creating an Ordered List
Ordered lists are created using the <ol> element as a container. Every individual item within that list must be wrapped in <li> (list item) tags. Browsers will automatically handle the incrementing of numbers for you.
Basic Syntax
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Output:
- First item
- Second item
- Third item
Types of Numbering
The type attribute in the <ol> tag allows you to specify different types of numbering styles to fit your content's context, such as legal documents or academic outlines.
1. Decimal (default)
Standard Arabic numerals. This is the default behavior if no type is specified.
<ol type="1">
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Output:
- First item
- Second item
- Third item
2. Uppercase Letters
Commonly used for multiple-choice questions or formal outlines.
<ol type="A">
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Output: A. First item B. Second item C. Third item
3. Lowercase Letters
<ol type="a">
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Output: a. First item b. Second item c. Third item
4. Uppercase Roman Numerals
Often seen in the "Preface" of books or for major sections in a legal document.
<ol type="I">
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Output: I. First item II. Second item III. Third item
5. Lowercase Roman Numerals
<ol type="i">
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Output: i. First item ii. Second item iii. Third item
type attribute is perfectly valid, modern developers often use the CSS property list-style-type to manage the visual appearance of lists, keeping the design separate from the HTML structure.
Starting Point
The start attribute allows you to specify the starting number of the list. This is extremely useful if you need to break a list into two sections (for example, putting an image or an advertisement in between two parts of a tutorial).
<ol start="5">
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Output: 5. First item
- Second item
- Third item
start attribute always accepts a numeric value (e.g., start="5"), even if your type is set to letters or Roman numerals. To start a list at "E", you would still use start="5".
Reversed Order
The reversed attribute is a boolean attribute that reverses the numbering. It is perfect for "Top 10" countdowns or showing a list of version updates from newest to oldest.
<ol reversed>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Output: 3. First item
- Second item
- Third item
Nesting Ordered Lists
You can nest ordered lists within other lists to create hierarchical structures, such as a Table of Contents with chapters and sub-sections.
<ol>
<li>Chapter 1
<ol>
<li>Section 1.1</li>
<li>Section 1.2</li>
</ol>
</li>
<li>Chapter 2
<ol>
<li>Section 2.1</li>
<li>Section 2.2</ol>
</ol>
</li>
</ol>
Output:
- Chapter 1
- Section 1.1
- Section 1.2
- Chapter 2
- Section 2.1
- Section 2.2
Summary
HTML ordered lists (<ol>) are a powerful tool for presenting sequential data clearly and semantically. By leveraging attributes like type, start, and reversed, you can handle almost any numbered data requirement—from simple "how-to" guides to complex legal numbering systems. Remember to keep your HTML clean by nesting properly and using CSS for purely decorative styling.