Lists · HTML

Ch 2 · Lists, Links & Images — card 1 of 4.

Group related items with lists: <ul> for bullets and <ol> for numbers — each item goes in an <li>. Lists make pages easier to scan, whether you are showing ingredients, steps or a menu. In the example, a heading introduces an unordered list of three favourite foods, so the browser shows bullet points. Try swapping <ul> for <ol> and watch the bullets turn into numbers.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>My Page</title>
  </head>
  <body>
    <h2>My Favourite Foods</h2>
    <ul>
      <li>Pizza</li>
      <li>Mango</li>
      <li>Sushi</li>
    </ul>
  </body>
</html>