Coding/Learn/html/lists
HTML Beginner Course
01.Introduction to HTML
02.Anatomy of an HTML Element
03.The Sacred HTML5 Skeleton
04.Headings (h1 to h6)
05.Paragraphs, Line Breaks & Dividers
06.Text Formatting & Emphasis
07.Hyperlinks & Navigation (<a>)
08.Images & The Sacred Alt Text (<img>)
09.Ordered & Unordered Lists (<ul>, <ol>, <li>)
10.Block vs Inline Elements
11.Generic Containers (<div> & <span>)
12.Semantic HTML (<header>, <nav>, <main>, <footer>)
13.Tables (<table>, <tr>, <th>, <td>)
14.Native Audio & Video Elements
15.The Invisible Brain (<head> & Meta Tags)
16.Interactive Forms (<form>)
17.Input Types (<input>)
18.Accessible Labels & Submit Buttons
19.Textareas & Select Dropdowns (<textarea>, <select>)
20.Capstone: Building Your First Web Profile Page
Course Certificate0%

Complete all lessons to earn

LearnOrdered & Unordered Lists (<ul>, <ol>, <li>)
9 / 20 0%
Lesson 09 of 20
4 mins read

Ordered & Unordered Lists (<ul>, <ol>, <li>)

PreviousNext Lesson
In Plain English

Lists organize items logically. Use <ul> (unordered list) for bullet points where sequence doesn't matter, and <ol> (ordered list) for numbered steps. Every item inside must be wrapped in an <li> (list item) tag.

The Mental Model

"<ul> is your grocery shopping list (buy apples, milk, bread in any order). <ol> is an IKEA furniture instruction manual (Step 1: attach leg, Step 2: tighten screw—mess up the order and your table collapses!)."

Deep Dive: How It Works

<ul>: Creates bulleted points (disc, circle, square).

<ol>: Creates numbered lists (1, 2, 3 or A, B, C or Roman numerals).

<li>: "List Item". Sits strictly inside <ul> or <ol>. Never place text directly inside <ul> without an <li> wrapper!

Nesting Lists: You can put a <ul> inside an <li> to create sub-bullet lists.

Syntax Blueprint

<ul>
  <li>Item 1</li>
  <li>Item 2</li>
</ul>

Parent list container wrapping individual <li> items.

PointCore Rules to Remember

Point star
ul = Bullets: Use when the order of items has no mathematical significance.
Point star
ol = Numbers: Use for chronological recipes, rankings, and sequential instructions.
Point star
Navbar Backbone: Modern website navbars are built by styling <ul> and <li> tags with CSS flexbox.

Common Beginner Traps & How to Fix Them

Mistake:Placing raw text directly inside <ul>

Why it happens: Writing <ul>Hello<li>Item</li></ul> breaks valid HTML specifications.

How to fix: All direct children of <ul> and <ol> must be <li> tags.

Pro Tip: You can reverse an ordered list simply by adding the boolean attribute: <ol reversed>.

Live Interactive Example

Hit Run Code to see it live
Bulleted vs Numbered Lists
HTML5
1
2
3
4
5
6
7
8
9
10
11
12
Live Browser Preview
Click "Preview / Apply" to view the rendered output.
How it works: <ul> produces bullet points while <ol> produces automated numerical indexing.

Your Turn: Micro Challenge

No pressure! Edit the starter code below and test your solution with instant feedback.

Micro Exercise

Build an unordered list of languages

  • PointCreate a <ul> container with two <li> items: "HTML" and "Python"
1
2
Browser Preview & Output
Click "Check HTML" to test your solution.

Finished reading and practicing?

Mark this lesson as completed to update your course progress.

PreviousNext Lesson
Overview100 SheetLearnCertificates