Please enable JavaScript to use CodeHS

Web Design Basics

HTML Lists

Lists make web pages easy to read. Learn the difference between ordered <ol> and unordered <ul> lists.

Beginner ~10 min All
The Big Idea

HTML lists group related items

Web pages often show lists. HTML gives you two main list types. An ordered list uses numbers when the order matters. An unordered list uses bullets when the order does not matter.

Here is an unordered list of tools a web developer might use:

<ul>
    <li>Computer</li>
    <li>Keyboard</li>
    <li>Browser</li>
</ul>

Each item goes inside an <li> tag, which stands for list item.


How It Works

Ordered, unordered, and nested lists

Use <ol> for ordered lists and <ul> for unordered lists. Nest one list inside another by placing a new list inside an <li>.

<ol>
    <li>Preheat the oven.</li>
    <li>Mix the batter.
        <ul>
            <li>Flour</li>
            <li>Sugar</li>
            <li>Eggs</li>
        </ul>
    </li>
    <li>Bake for 20 minutes.</li>
</ol>

Ordered lists are good for steps. Unordered lists are good for groups where order does not matter.


Interactive

Build a list

Type items one per line. Choose ordered or unordered, then see the HTML and the rendered list.


        

Your Turn

Check yourself

Write the HTML for an ordered list of three things you did today.

Sample answer:
<ol>
  <li>Woke up</li>
  <li>Ate breakfast</li>
  <li>Brushed teeth</li>
</ol>


Code

A list example

HTML has tags for ordered, unordered, and description lists. This example shows all three.


Check Yourself

Quick quiz

1. Which tag makes a numbered list?

2. What does <li> stand for?

3. Which list uses bullets?

Keep learning

You can make lists in HTML. Try styling them with CSS next.