HTML Lists (ul, ol, li)

HTML lists group related items together. An unordered list <ul> shows bulleted items, an ordered list <ol> shows numbered items, and each item goes inside an <li> element.

Web

Use an ordered list when sequence matters (like steps in a recipe) and an unordered list when it does not (like a set of features).

Lists are also the standard way to build navigation menus, which are then styled with CSS to look like menu bars.

Examples

HTML

<ul>
  <li>Apples</li>
  <li>Bananas</li>
</ul>
<ol>
  <li>Mix</li>
  <li>Bake</li>
</ol>

Output:

Renders a bulleted list (Apples, Bananas) and a numbered list (1. Mix, 2. Bake).

Learn it in a lesson

See also

Back to the Dictionary