Lesson 22 of 51 · Module 4, lesson 1 of 6 · 3 min
Bulleted and nested lists
Make bulleted lists, put lists inside lists, and choose the right kind of list.
What you'll learn
- How to make a bulleted list with
<ul>and<li>- How to put a list inside another list
- Which kind of list to choose
Why this matters
Lists are everywhere: ingredients, features, menus, to-do lists. Written as a real list, the browser adds the bullets, and a screen reader announces "list, 4 items" so that the listener knows what is coming. Lines separated with <br> get none of that.
Three kinds of list
HTML has three kinds of list. This lesson covers the first; the next two lessons cover the others.
| List | Use it when | Elements |
|---|---|---|
| Unordered (bulleted) | The order does not matter | <ul> and <li> |
| Ordered (numbered) | The order matters | <ol> and <li> |
| Description | Terms with their explanations | <dl>, <dt> and <dd> |
A bulleted list
<ul> means unordered list. Each item is an <li> (list item).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shopping list</title>
</head>
<body>
<h1>Shopping list</h1>
<ul>
<li>Tomatoes</li>
<li>Onions</li>
<li>Bread</li>
<li>Olive oil</li>
</ul>
</body>
</html>
What you'll see: four items, each on its own line, with a round bullet in front, moved in from the left.
Only <li> elements may go directly inside <ul>. Inside an <li>, you can put text, links, images — even another list.
Lists inside lists
To group items, put a whole new <ul> inside an <li>:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shopping list</title>
</head>
<body>
<h1>Shopping list</h1>
<ul>
<li>Vegetables
<ul>
<li>Tomatoes</li>
<li>Onions</li>
</ul>
</li>
<li>Bakery
<ul>
<li>Bread</li>
</ul>
</li>
</ul>
</body>
</html>
What you'll see: "Vegetables" and "Bakery" with round bullets, and their items moved further in, with a different bullet (usually an empty circle).
Notice where the inner <ul> is: inside the <li>, before its </li>.
Menus are lists too
A group of navigation links is a list of links. You will use this often:
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="recipes.html">Recipes</a></li>
<li><a href="about.html">About me</a></li>
</ul>
The bullets and indentation can be removed later with CSS. The list structure stays, and screen readers still say "list, 3 items".
Try it yourself
- Select the first example and choose Try it.
- Add two more items.
- Turn one item into a group with its own inner list.
- Put a link inside one of the items.
Common mistakes
- Text directly inside
<ul>, outside any<li>. It is not valid, and screen readers get the count wrong. Fix: every item is an<li>. - The inner list outside the
<li>, such as</li><ul>…</ul>. Fix: put it inside the<li>, before</li>. - Using
<br>or typed dashes instead of a list. No list is announced. Fix: use<ul>and<li>. - Choosing a list for its look. Bullets are a style; you can change or remove them with CSS. Fix: choose
<ul>because the content is a list.
Check yourself
- Which element holds each item of a list?
- Where does an inner list go?
- Is a menu of links a list?
Answers
<li>.- Inside an
<li>of the outer list, before its</li>. - Yes — usually a
<ul>of<li>elements, each containing a link.
Next: when the order matters — steps, rankings — you need a numbered list.


