liveBook · Manning

Ol element

As explained in Web Design Playground, Second Edition

An ordered list is an HTML list whose items are presented in sequential order with automatically generated markers.

The <ol> element creates an ordered, or numbered, list. Use it when items have an inherent sequence, such as procedure steps, recipe tasks, document sections, or rankings. The browser supplies the numbers, so you do not have to play accountant. section 3.7 section 3.8

Build a numbered list by placing one or more list items inside the <ol> container:

  • Start with <ol> and finish with </ol>. section 3.8
  • Wrap each item in <li> and </li>; the closing tag is optional but recommended. section 3.8
  • Let the browser number items according to their position and renumber them when items are inserted or deleted. section 3.8

A top-10 list

<h3>Top 10 Modern Words of Unknown Origin</h3> <ol> <li><em>jazz</em> (1909)</li> <li><em>jive</em> (1928)</li> <li><em>bozo</em> (1920)</li> </ol> The browser displays each item with a number on the left and indents the item text. section 3.8

<h3>Top 10 Modern Words of Unknown Origin</h3>
<ol>                                     #1
    <li><em>jazz</em> (1909)</li>        #2
    <li><em>jive</em> (1928)</li>        #2
    <li><em>bozo</em> (1920)</li>        #2
    <li><em>dork</em> (1964)</li>        #2
    <li><em>pizzazz</em> (1937)</li>     #2
    <li><em>humongous</em> (1970)</li>   #2
    <li><em>gismo</em> (1943)</li>       #2
    <li><em>zit</em> (1966)</li>         #2
    <li><em>reggae</em> (1968)</li>      #2
    <li><em>mosh</em> (1987)</li>        #2
</ol>                                    #1

Inspect the complete numbered-list example, including the <ol> container and its <li> items. section 3.8

How Web Design Playground, Second Edition covers it

How deep it goes
Defines <ol> and <li> construction, browser numbering, indentation, and automatic renumbering, but defers detailed styling.
Examples
Demonstrates procedure steps, recipe tasks, document sections, rankings, and a top-10 word-origin list.
What it assumes
Assumes basic HTML element familiarity while teaching the <ol> container and <li> item structure directly.
What you can do after
Apply it via HTML to build automatically numbered lists whose markers update when items change.
How it connects
Contrasts ordered lists with unordered lists and mentions description lists and CSS list-style-type values.

Also explained in

Compare how 2 books explain ol element →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Design Playground, Second Edition. The section links point to the parts of the book it draws on.