thecodezone.
The Code Zone
Short steps, at your pace · Free lessons and practice · Member video walkthroughs
Save your next small win.

Checking your account…

04.01 · Lists, links and images / Learn · 12 min

HTML Lists: Group Items and Put Steps in Order

Build lists with Rob, plan a study session, then complete a developer ticket using the written Roman-numeral example.

Activity 1 of 7 in Lists, links and images

All courses

HTML Basics / 04.01

HTML lists and numbering

Not started

Use ul for a collection, ol for a sequence, and type to choose numbers, letters or Roman numerals.

More options

Your lesson progress

Reading & video: not startedMini-lesson: not startedDeveloper ticket: not started

Empty: not started. Yellow: in progress. Green: complete. Marking the whole activity complete does not replace your test results. These circles save in this browser for this pilot.

Rob explains how unordered and ordered lists organize related items.
Rob’s comic strip · Lists, links and images

ORIGINAL WALKTHROUGH · 11:27

Watch with Rob.

Pause whenever you want to try a change. You can return to the lesson at any time.

LEARN WITH THE CODE ZONE

Unlock this video walkthrough

Written lessons and coding practice are free. Video walkthroughs are included with a paid Code Zone membership or an active free trial.

Have a Code Zone website account? Use your learning account’s email to get a six-digit sign-in code, or use your existing website password.

Need a website account? Paid Skool members and active trial members can use the email from their membership questions to request a sign-in code. No invite link or Skool password needed.

Close this window to keep practicing. After signing in, you’ll return to this lesson.

Video walkthroughs are included with an active Code Zone membership. The written lesson and practice are free.

Open video & code editor (opens in a new tab)

Starter source code for VS Code

Copy the source below or download the file to follow along in VS Code.

The download includes a lesson link in each file and a README so you can find your way back.

index.html
index.htmlhtml · example
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>List Elements</title>
</head>
<body>
  <!-- Add the Todo heading and unordered list. -->

  <!-- Add a heading and ordered vacation destinations. -->
</body>
</html>

Why give related items a list?

A shopping list and a set of directions both contain related items, but their order means different things. HTML gives you list elements to express that difference. A list also helps people and assistive software recognize the items as a group.

Use <ul> for an unordered collection, <ol> for an ordered sequence, and <li> for each list item. The browser normally adds bullets or numbers, indentation and some space around the list. You do not type the markers yourself.

An unordered list: the collection matters

These three things belong in a walking kit. Putting Map first would not change what you need to bring, so <ul> is a good choice. Keep each item inside its own <li> element.

Unordered does not mean random. The browser still displays the items in the order you write them.

Loading the editable HTML example…

Edit the HTML and watch the preview update. On a smaller screen, the preview appears below the code. These examples are for exploring; use the mini-lesson for saved, checked practice.

An ordered list: the sequence matters

Here, choose a book comes before reading it. Use <ol> when the sequence or ranking is part of the meaning. The same <li> element works inside either kind of list.

If you move a whole list item, the browser updates its number. Keep the words free of typed number prefixes so they do not become out of date.

Loading the editable HTML example…

Edit the HTML and watch the preview update. On a smaller screen, the preview appears below the code. These examples are for exploring; use the mini-lesson for saved, checked practice.

Choose numbers, letters or Roman numerals

An attribute is extra information written inside an opening tag. Here, type="I" on <ol> tells the browser which numbering format to use. Write the attribute on the list, not separately on each item.

A plain <ol> uses numbers by default. The five examples below show the available formats. Capitalization matters: uppercase I produces I, II, III, while lowercase i produces i, ii, iii.

Choose an HTML tab below to compare the five formats. Each tab has the same three items; only the list’s opening tag changes. These formats apply to ordered lists, not to the bullets of a ul.

Loading the editable HTML example…

Choose a tab to compare examples. Edits stay in their tab while this page is open. Edit the HTML and watch the preview update. On a smaller screen, the preview appears below the code. These examples are for exploring; use the mini-lesson for saved, checked practice.

Try uppercase Roman numerals

Choose the HTML · I, II, III tab above. Its type="I" attribute makes the browser add uppercase Roman numerals in front of the unchanged item text. Switch to HTML · i, ii, iii to compare lowercase markers.

A numbered label can be part of a document’s meaning: a handout might refer to item II. That is the situation in your developer ticket below. Later, CSS will let you control marker appearance when it is only a visual preference.

Try the two-step study-session mini-lesson

No headphones needed. Turn three supplies into a bulleted collection, then move one action into the correct position in a numbered sequence. Each step has exact tasks, a hint and checks.

The mini-lesson opens in a new tab. Your own code carries forward; each step has a focused check and an optional hint.

Start mini-lesson(opens in a new tab)

2 steps · Saved work · Instant feedback

Keyboard skill: move a whole list item

Keep one complete <li>...</li> on each line. Put the cursor on the item you want to move, then press Option (Alt) + Up Arrow on Mac, or Alt + Up Arrow on Windows/Linux. The whole line moves above the one before it. Selecting the line first also works.

Use this in Step 2 to move Read the task above Write code. The checks judge the resulting order, so moving the item manually is fine.

Optional: a list inside a list item

A sublist belongs inside the parent <li>, before that item’s closing tag. This is different from placing one list directly inside another list without a list item around it. Rob mentions nested lists as extra reading; they are not required for this mini-lesson or ticket.

Loading the editable HTML example…

Edit the HTML and watch the preview update. On a smaller screen, the preview appears below the code. These examples are for exploring; use the mini-lesson for saved, checked practice.

Code along with Rob, then take the ticket

The original video builds a Todo collection and ranked vacation destinations. Its code-along opens in the website editor, in theater mode or a pop-out, with a document skeleton ready for you to type.

The developer ticket at the bottom adds a small new skill from this written lesson: change the agenda markers to uppercase Roman numerals. You can return to the examples above while you work.

YOUR TURN

Developer ticket: switch the agenda to Roman numerals

Open index.html and follow the checklist. Run the preview, then choose Check challenge. Keep the supplied content unless an item asks you to change it.

To pass this challenge
  • Inside body, find the ol immediately after the h2 containing Agenda.
  • Add the type attribute to that ol and set its value to uppercase I.
  • Keep its three li items in order: Welcome, Project updates, Questions.
  • Let the browser generate Roman numerals. Do not type number prefixes or add start, reversed or item-value overrides.
  • Keep the Supplies ul and its three items unchanged. Close both lists.

Inspect the HTML source and preview. Run code or Check challenge checks your source tags and page structure. Automatic formatting is off for this review. Word wrap is enabled.

Ready to checkRun the checks to see your results here.

Need a nudge?

Where does type belong?

Edit the opening <ol> for Agenda. The uppercase letter I is the value for uppercase Roman numerals. Keep each li and its words unchanged. The closing tag remains </ol>.

Replace your editor code?

Your current work will be replaced. Choose Cancel to keep it.

Ready to try it?

Practice in your browser and see your results.

Progress details

Have a question?

Ask the Code Zone community.

Ask a question in The Code Zone (opens in a new tab)

Continue learning

ONE STEP FORWARD

Choose ul or ol for the meaning. Put each item in li and let the browser supply the markers.