liveBook · Manning

Ol element

As explained in Build a Website with ChatGPT

An ordered list is an HTML list whose items are displayed in a meaningful sequence, typically with numeric markers.

The <ol> element creates an ordered list: a vertical collection of items whose sequence matters. Browsers usually place a number before each item, making it a good fit for instructions, rankings, and other content that readers should follow in order. The name ol is short for “ordered list.” section 9.3 section 9.7

Put each entry inside an <li> element, short for “list item.” A basic ordered list starts numbering at 1 automatically. The HTML tags provide the structure; the text between each opening and closing <li> tag is the visible item. section 9.3

A simple ordered list

Use this structure for a sequence of steps or ranked items: <ol> <li>Inflatable Dartboard</li> <li>Water-Resistant Sponge</li> <li>Helium-Filled Paperweight</li> </ol> The browser displays the three items as 1, 2, and 3. When asking ChatGPT to generate the list, provide the items clearly; dash-prefixed lines, plus signs, asterisks, or numbered Markdown lines can identify them as list entries. section 9.3

Choose an ordered list when changing the item order would change the meaning. Recipe directions should begin with the first step and continue to the last; a top-10 ranking commonly counts down from 10 to 1. Use a bulleted list instead when the order is not essential. section 9.3 section 9.7

Ordered lists can be customized for sequences that do not begin at 1. A reversed list suits a countdown ranking. A list can also begin at a chosen number, which helps when showing part of a larger numbered document or continuing steps after intervening text. section 9.3.1 section 9.3.2

A list inside another list is nested. Nested numbered lists are useful when a main recipe step needs its own smaller sequence. CSS can change a nested ol element’s list-style-type; for example, lower-alpha uses lowercase letters rather than the default numeric markers. section 9.4 section 9.6

<ol>
    <li>Inflatable Dartboard</li>
    <li>Water-Resistant Sponge</li>
    <li>Helium-Filled Paperweight</li>
    <li>Teflon Bath Mat</li>
    <li>Flame-Retardant Firewood</li>
</ol>

Inspect the generated HTML to see how one <ol> wrapper contains several <li> items. section 9.3

In a recipe page, use bulleted lists for ingredient groups and an ordered list for the preparation steps. Keep the <li> and </li> tags around each item when editing its wording, so the browser continues to recognize it as part of the list. section 9.1 section 9.6

How Build a Website with ChatGPT covers it

How deep it goes
Explains basic ol and li markup, reversal, custom starts, nesting, and list-style customization without deeper browser internals.
Examples
Demonstrates novelty-item lists, a reversed top-10 list, continued boiling steps, and nested recipe instructions.
What it assumes
Teaches ordered-list markup from zero while assuming only a need to create or edit HTML page content.
What you can do after
Build it from scratch using ol and li tags, then reverse, continue, nest, or restyle the sequence.
How it connects
Connects ordered lists with li elements, bulleted lists, nested lists, CSS list-style-type, and recipe pages.

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 Build a Website with ChatGPT. The section links point to the parts of the book it draws on.