Course
HTML Fundamentals
Progress87%
HTML FundamentalsSection 2Lists: Ordered & Unordered
Lists: Ordered & Unordered
20 XP on completion~8 min
HTML Lists
Lists are one of the most useful elements in HTML. They let you group related content in a structured, readable way. HTML gives you two main types: ordered and unordered.
Unordered Lists
Use <ul> when the order of items doesn't matter — like a grocery list or a list of features. Each item is wrapped in <li>.
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>Ordered Lists
Use <ol> when sequence matters — like steps in a recipe or a ranked list. The browser automatically numbers each <li>.
<ol>
<li>Open your editor</li>
<li>Create index.html</li>
<li>Write your HTML</li>
<li>Open in browser</li>
</ol>Nested Lists
You can nest a list inside another <li> to create sub-items. This is great for navigation menus and outlines.
<ul>
<li>Frontend
<ul>
<li>HTML</li>
<li>CSS</li>
</ul>
</li>
<li>Backend</li>
</ul>Challenge
In the editor on the right, create an ordered list of the first 5 planets in our solar system, and a nested unordered list under Earth showing its two main properties: atmosphere and water.
Task Checklist
Create an <ol> with 5 planets
Add Earth as item 3
Nest a <ul> inside Earth with atmosphere and water
Validate your HTML is well-formed
or run your code in the IDE →
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18