Lesson 3 of 14 · 6 min

Lists

Lists are everywhere on the web: menus, shopping lists, steps in a recipe. HTML has two common kinds.

An unordered list shows bullet points, for items where the order doesn't matter:

<ul>
  <li>Sadza</li>
  <li>Rice</li>
  <li>Chapati</li>
</ul>

An ordered list numbers its items, for steps that happen in order:

<ol>
  <li>Boil the water</li>
  <li>Add the maize meal</li>
  <li>Stir until thick</li>
</ol>

<ul> and <ol> hold the list. Each item goes in its own <li> ("list item"). Notice the <li> tags sit inside the <ul> tags. This is called nesting, and the rule is simple: close tags in the reverse order you opened them, like boxes inside boxes. The spaces at the start of each <li> line are only there to make the code easier to read.

Your task

  1. Under My favourite foods, add an unordered list with at least three foods.
  2. Under My morning routine, add an ordered list with at least three steps.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Lists</title>
</head>
<body>
  <h1>A few of my things</h1>

  <h2>My favourite foods</h2>
  <!-- Add an unordered list (ul) here -->

  <h2>My morning routine</h2>
  <!-- Add an ordered list (ol) here -->

</body>
</html>

Your page

Discussion

Stuck? Ask here. Be kind, and share hints rather than full answers.

Loading the discussion…