Hello! Welcome back to your web development journey.
In the last lesson, we focused on giving text a clear structure using headings, paragraphs, and line breaks. You learned that these HTML tags are not just for visual formatting but for creating a logical hierarchy that both humans and machines can understand.
Today, we'll continue exploring content structure by learning how to create ordered and unordered lists. Lists are a fundamental part of HTML used for everything from simple shopping lists to the navigation menus you see on almost every website. By the end of this lesson, you'll be able to group related items into clean, well-structured lists.
Unordered Lists: When Order Doesn't Matter
Let's start with the most common type of list: the unordered list. You use this when you have a set of items where the sequence is not important. Think of a list of ingredients for a pizza or key features of a product. The browser typically displays these items with bullet points.
To create an unordered list, you use two types of tags:
<ul>: The "unordered list" tag. This acts as a wrapper for the entire list.<li>: The "list item" tag. Each item in the list gets its own<li>tag, placed inside the<ul>element.
Let's watch a quick video that demonstrates how to create one.
Learn HTML lists in 4 minutes 📋
This short clip from the 'Learn HTML lists in 4 minutes' video by Bro Code provides a fast and clear example of creating an unordered list for a shopping list.
Watch from 00:12 to 01:16. Pay attention to how the <ul> tag contains all the <li> elements.
As you saw, the structure is <ul> wrapping one or more <li> elements.
<!-- Example of an Unordered List -->
<ul>
<li>Pizza dough</li>
<li>Tomato sauce</li>
<li>Cheese</li>
</ul>
Ordered Lists: When Order is Key
What if the sequence of your items is important? For instructions, steps in a process, or a ranked list, you need an ordered list. Browsers will display these items with numbers by default.
The structure is very similar to an unordered list, but you use the <ol> tag instead:
<ol>: The "ordered list" tag. This is the main container.<li>: The same "list item" tag is used for each item inside the<ol>.
Let's see this in action.
Learn HTML lists in 4 minutes 📋
Continuing with the same video, this next segment shows how to create an ordered list and also introduces the type attribute, which lets you change the numbering style.
Watch from 01:16 to 02:25. Notice that only the container tag changes from <ul> to <ol>; the <li> tags remain the same.
Here's the code for a basic ordered list:
<!-- Example of an Ordered List -->
<ol>
<li>Eat breakfast</li>
<li>Take a shower</li>
<li>Leave for work</li>
</ol>
As the video mentioned, you can change the numbering style using the type attribute on the <ol> tag (e.g., <ol type="a"> for lowercase letters or <ol type="I"> for uppercase Roman numerals).
Reading: Reinforcing Your Knowledge
Videos are great for a quick overview, but reading documentation helps solidify the details. The MDN Web Docs are an essential resource for any web developer. Please read the following sections to get a more in-depth understanding of unordered and ordered lists.
Lists - Learn web development | MDN
This article from MDN, 'Lists', is the definitive guide. It provides clear examples and explanations for both list types we've discussed.
Please read the sections titled 'Unordered lists' and 'Ordered'. You can skip the interactive exercises for now, as we'll do our own practice at the end of the lesson.
Other List Types and Nesting
While ordered and unordered lists are the most common, HTML provides a third type: the description list. It's used for pairs of terms and their definitions, like in a glossary. It uses <dl> (description list), <dt> (description term), and <dd> (description definition).
A more powerful feature is nesting lists, where you place a list inside another list item. This is perfect for creating outlines or sub-items.

To nest a list, you simply start a new <ul> or <ol> inside an <li> element.
Let's watch one last quick clip to see how this works.
Learn HTML lists in 4 minutes 📋
This final clip from the Bro Code video shows how to nest an unordered list inside another list item to create a sub-list of toppings.
Watch from 03:27 to 04:13. The key rule to remember is that a new list must be placed inside an <li> tag, not directly inside another <ul> or <ol>.
To understand the rule for nesting correctly, a quick read is in order.
Lists - Learn web development | MDN
Let's return to the MDN article to read the section on nesting. This will clarify the rule you just saw in the video.
Please read the section titled 'Nesting lists'. Focus on the code structure and how the nested <ul> is placed within an <li>.
Practice: Adding Lists to Your Page
It's time to apply what you've learned. Open your index.html file and add the following section to the <body>, right below the "My Goals" section you created in the last lesson.
Instructions:
- Add a new
<h2>with the text "My Learning Plan". - Below this heading, create an ordered list (
<ol>) for the main learning phases. - The list items should be: "Master the Frontend" and "Conquer the Backend".
- Inside the "Master the Frontend" list item, nest an unordered list (
<ul>) with the following technologies to learn: "HTML", "CSS", and "JavaScript".
Here is the unstructured text to guide you:
My Learning Plan
Master the Frontend
HTML
CSS
JavaScript
Conquer the Backend
Once you've added the tags, save the file and check the result in your browser. It should look like a numbered list with a bulleted sub-list.
Click here to see the solution.
<h2>My Learning Plan</h2>
<ol>
<li>
Master the Frontend
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</li>
<li>Conquer the Backend</li>
</ol>
Conclusion
Excellent work! You can now organize content into structured lists, a skill you'll use constantly as a web developer.
Here are the key takeaways from this lesson:
- Use
<ul>for unordered lists where the sequence doesn't matter (bullet points). - Use
<ol>for ordered lists where the sequence is important (numbered items). - Use
<li>for each list item inside both<ul>and<ol>. - Lists can be nested inside other list items to create hierarchical structures.
In our next lesson, we'll take a significant step forward by learning about semantic HTML. We'll explore tags like <header>, <footer>, <main>, and <nav>, which give even more meaning and structure to different sections of your webpage. You'll see how the <ul> you learned today is the standard way to build navigation menus inside a <nav> element.