files/en-us/web/html/reference/elements/ol/index.md
The <ol> HTML element represents an ordered list of items — typically rendered as a numbered list.
{{InteractiveExample("HTML Demo: <ol>", "tabbed-shorter")}}
<ol>
<li>Mix flour, baking powder, sugar, and salt.</li>
<li>In another bowl, mix eggs, milk, and oil.</li>
<li>Stir both mixtures together.</li>
<li>Fill muffin tray 3/4 full.</li>
<li>Bake for 20 minutes.</li>
</ol>
li {
font:
1rem "Fira Sans",
sans-serif;
margin-bottom: 0.5rem;
}
This element also accepts the global attributes.
compact {{Deprecated_inline}} {{non-standard_inline}}
compact attribute, the CSS property {{cssxref("line-height")}} can be used with a value of 80%.reversed
start
type is letters or Roman numerals. For example, to start numbering elements from the letter "d" or the Roman numeral "iv," use start="4".type
: Sets the numbering type:
a for lowercase lettersA for uppercase lettersi for lowercase Roman numeralsI for uppercase Roman numerals1 for numbers (default)The specified type is used for the entire list unless a different type attribute is used on an enclosed {{HTMLElement("li")}} element.
[!NOTE] Unless the type of the list number matters (like legal or technical documents where items are referenced by their number/letter), use the CSS {{CSSxRef("list-style-type")}} property instead.
Typically, ordered list items display with a preceding marker, such as a number or letter.
The <ol> and {{HTMLElement("ul")}} (or the synonym {{HTMLElement("menu")}}) elements may nest as deeply as desired, alternating between <ol>, <ul> (or <menu>) as needed.
The <ol> and {{HTMLElement("ul")}} elements both represent a list of items. The difference is with the <ol> element, the order is meaningful. For example:
To determine which list to use, try changing the order of the list items; if the meaning changes, use the <ol> element — otherwise you can use {{HTMLElement("ul")}} otherwise, or {{HTMLElement("menu")}} if your list is a menu.
<ol>
<li>Fee</li>
<li>Fi</li>
<li>Fo</li>
<li>Fum</li>
</ol>
{{EmbedLiveSample("Basic_example", 400, 100)}}
<ol type="i">
<li>Introduction</li>
<li>List of Grievances</li>
<li>Conclusion</li>
</ol>
{{EmbedLiveSample("Using_Roman_Numeral_type", 400, 100)}}
<p>Finishing places of contestants not in the winners' circle:</p>
<ol start="4">
<li>Speedwalk Stu</li>
<li>Saunterin' Sam</li>
<li>Slowpoke Rodriguez</li>
</ol>
{{EmbedLiveSample("Using_the_start_attribute", 400, 100)}}
<ol>
<li>first item</li>
<li>
second item
<!-- closing </li> tag is not here! -->
<ol>
<li>second item first subitem</li>
<li>second item second subitem</li>
<li>second item third subitem</li>
</ol>
</li>
<!-- Here's the closing </li> tag -->
<li>third item</li>
</ol>
{{EmbedLiveSample("Nesting_lists", 400, 150)}}
<ol>
<li>first item</li>
<li>
second item
<!-- closing </li> tag is not here! -->
<ul>
<li>second item first subitem</li>
<li>second item second subitem</li>
<li>second item third subitem</li>
</ul>
</li>
<!-- Here's the closing </li> tag -->
<li>third item</li>
</ol>
{{EmbedLiveSample("Unordered_list_inside_ordered_list", 400, 150)}}
{{Specifications}}
{{Compat}}
<ol> element:
compact attribute