`<ol>` HTML ordered list element
The <ol> HTML element represents an ordered list of items — typically rendered as a numbered list.
The **`<ol>`** [HTML](/docs/Web/HTML) element represents an ordered list of items — typically rendered as a numbered list.
tabbed-shorter
```html interactive-example
<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>
```
```css interactive-example
li {
font:
1rem "Fira Sans",
sans-serif;
margin-bottom: 0.5rem;
}
```
## Attributes
This element also accepts the [global attributes](/docs/Web/HTML/Reference/Global_attributes).
- `compact`
- : This Boolean attribute hints that the list should be rendered in a compact style. The interpretation of this attribute is browser-specific. Use [CSS](/docs/Web/CSS) instead: to give a similar effect as the `compact` attribute, the CSS property line-height can be used with a value of `80%`.
- `reversed`
- : This Boolean attribute specifies that the list's items are in reverse order. Items will be numbered from high to low.
- `start`
- : An integer to start counting from for the list items. Always an Arabic numeral (1, 2, 3, etc.), even when the numbering `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 letters
- `A` for uppercase letters
- `i` for lowercase Roman numerals
- `I` for uppercase Roman numerals
- `1` for numbers (default)
The specified type is used for the entire list unless a different [`type`](/docs/Web/HTML/Reference/Elements/li#type) attribute is used on an enclosed 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 list-style-type property instead.
## Usage notes
Typically, ordered list items display with a preceding [marker](/docs/Web/CSS/Reference/Selectors/::marker), such as a number or letter.
The `<ol>` and ul (or the synonym menu) elements may nest as deeply as desired, alternating between `<ol>`, `<ul>` (or `<menu>`) as needed. To nest a list, place it inside an li element of the parent list; a list element can not be a direct child of another `<ul>` or `<ol>`.
The `<ol>` and ul elements both represent a list of items. The difference is with the `<ol>` element, the order is meaningful. For example:
- Steps in a recipe
- Turn-by-turn directions
- The list of ingredients in decreasing proportion on nutrition information labels
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 ul otherwise, or menu if your list is a menu.
## Examples
### Basic example
```html
<ol>
<li>Fee</li>
<li>Fi</li>
<li>Fo</li>
<li>Fum</li>
</ol>
```
#### Result
400
### Using Roman Numeral type
```html
<ol type="i">
<li>Introduction</li>
<li>List of Grievances</li>
<li>Conclusion</li>
</ol>
```
#### Result
400
### Using the start attribute
```html
<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>
```
#### Result
400
### Nesting lists
```html
<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>
```
#### Result
400
### Unordered list inside ordered list
```html
<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>
```
#### Result
400
## Technical summary
<table class="properties">
<tbody>
<tr>
<th scope="row">
<a href="/en-US/docs/Web/HTML/Guides/Content_categories"
>Content categories</a
>
</th>
<td>
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#flow_content"
>Flow content</a
>, and if the <code><ol></code> element's children include at least
one li element,
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#palpable_content"
>palpable content</a
>.
</td>
</tr>
<tr>
<th scope="row">Permitted content</th>
<td>
Zero or more li,
script and
template elements.
</td>
</tr>
<tr>
<th scope="row">Tag omission</th>
<td>None, both the starting and ending tag are mandatory.</td>
</tr>
<tr>
<th scope="row">Permitted parents</th>
<td>
Any element that accepts
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#flow_content"
>flow content</a
>.
</td>
</tr>
<tr>
<th scope="row">Implicit ARIA role</th>
<td>
<code
><a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/list_role"
>list</a
></code
>
</td>
</tr>
<tr>
<th scope="row">Permitted ARIA roles</th>
<td>
<a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/directory_role"><code>directory</code></a>, <a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/group_role"><code>group</code></a>,
<a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/listbox_role"><code>listbox</code></a>, <a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/menu_role"><code>menu</code></a>,
<a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/menubar_role"><code>menubar</code></a>, <a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/none_role"><code>none</code></a>,
<a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/presentation_role"><code>presentation</code></a>,
<a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/radiogroup_role"><code>radiogroup</code></a>, <a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/tablist_role"><code>tablist</code></a>,
<a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/toolbar_role"><code>toolbar</code></a>, <a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/tree_role"><code>tree</code></a>
</td>
</tr>
<tr>
<th scope="row">DOM interface</th>
<td>HTMLOListElement</td>
</tr>
</tbody>
</table>
## Specifications
## Browser compatibility
## See also
- Other list-related HTML Elements: ul, li, menu
- CSS properties that may be specially useful to style the `<ol>` element:
- the list-style property, to choose the way the ordinal displays
- [CSS counters](/docs/Web/CSS/Guides/Counter_styles/Using_counters), to handle complex nested lists
- the line-height property, to simulate the deprecated `compact` attribute
- the margin property, to control the list indentation
Cite this
"` ` HTML ordered list element". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ol