liveBook · Manning

List item element

As explained in Web Design Playground

An HTML element that represents a list item within an ordered or unordered list.

A list item element marks one entry in an HTML list. Write the entry between opening and closing <li> tags, then place it inside an <ol> ordered-list container or a <ul> unordered-list container. section 3.18 section 3.15

Choose the list container according to the kind of collection you are making:

  • Use <ol> when the entries belong in a sequence, such as recipe steps, instructions, document sections, or rankings. The browser supplies numbers and updates them when entries are inserted or removed. section 3.14
  • Use <ul> when the entries are related but have no required numeric order, such as groceries, tasks, traits, or prerequisites. The browser supplies bullets automatically. section 3.16
  • Change the marker style with the CSS list-style-type property, including decimal, alphabetic, Roman numeral, Greek, disc, circle, or square styles. section 3.15 section 3.17

A tiny numbered list

Wrap each entry in <li> tags: <ol><li>Choose ingredients</li><li>Mix everything</li><li>Serve</li></ol>. The browser displays the entries as 1, 2, and 3 without manually typed numbers. section 3.14

<li>Item text</li>

Use this compact pattern as a starting point for either an ordered or unordered list. section 3.14 section 3.16

How Web Design Playground covers it

How deep it goes
Explains tag placement, automatic markers, list containers, and CSS marker changes through short construction examples.
Examples
Uses recipe steps, rankings, top-ten lists, groceries, tasks, traits, and prerequisites as list examples.
What you can do after
Build it from scratch by placing item text inside li tags within ol or ul containers.
How it connects
Connects list item elements with ordered lists, unordered lists, and the list-style-type CSS property.

Also explained in

Compare how 3 books explain list item element →

Related concepts

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