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
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.
Your lesson progress
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.

ORIGINAL WALKTHROUGH · 11:27
Watch with Rob.
Pause whenever you want to try a change. You can return to the lesson at any time.
You are signed in, but video access needs attention. Check your account access. Your saved work is kept.
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)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.
- W3Schools: ordered lists and the type attribute (opens in a new tab)
- MDN: ordered-list numbering types (opens in a new tab)
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.
- Inside
body, find the ol immediately after the h2 containingAgenda. - Add the
typeattribute to that ol and set its value to uppercaseI. - 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
Suppliesul 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.
Your check results
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>.
One possible solution
Your code may look different and still be correct. Compare the approach with your own.
The agenda is still ordered. type="I" changes its marker format, while the li elements keep the same words and order. The browser generates I, II and III, so you never type those markers into the item text.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Meeting agenda</title>
</head>
<body>
<h1>Community meeting</h1>
<h2>Supplies</h2>
<ul>
<li>Projector</li>
<li>Sign-in sheet</li>
<li>Pens</li>
</ul>
<h2>Agenda</h2>
<ol type="I">
<li>Welcome</li>
<li>Project updates</li>
<li>Questions</li>
</ol>
</body>
</html>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)