HTML Unordered Lists: The <ul> and <li> Tags

Learn how to organize content with bulleted lists, a fundamental skill for creating navigation, feature lists, and more.

Lesson ProgressStep 1 of 8
  • Fruits
  • Vegetables
    • Carrots
    • Broccoli
  • Milk
  1. Mix flour
  2. Bake
0 EXP

Let's learn how to organize content with lists! We'll start with 'unordered lists', which are perfect for bullet points.

The Unordered List: <ul>

The <ul> tag stands for **Unordered List**. It's the main container you use when you want to create a list of items where the order *does not* matter. Think of a shopping list, a list of features, or navigation links. By default, browsers will render this list with bullet points.

<ul>
  
</ul>

This tag doesn't hold the items directly; it only serves as the wrapper that groups them together.

System Check

What is the primary purpose of the <ul> tag?

Advanced Holo-Simulations

0 EXP

Log in to unlock these advanced training modules and test your skills.


Achievements

✍️
List Syntax Master

Correctly use <ul> and <li> tags to create a valid list.

🏗️
Structure Whiz

Build a valid nested list.

🏆
Semantics Expert

Prove your mastery of when to use <ul> vs. <ol>.

Mission: Build a Grocery List

Create an unordered list (<ul>) with at least three list items (<li>) for your grocery list. Our AI assistant will provide real-time feedback.

A.D.A. Feedback:

> Awaiting input...

Challenge: Order the Nested List

Nesting can be tricky. Drag the elements into the correct order to create a sub-list for "Fruits" containing "Apple".

<li>Fruits
<ul>
<li>Apple</li>
<ul>
</li>
</ul>
</ul>

Challenge: Complete the Syntax

Fill in the missing parts of the tags to complete the HTML list.

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

Consult A.D.A.

Community Holo-Net

Peer Project Review

Submit your "Grocery List" project for feedback from other Net-Runners.

The Unsung Hero of HTML: Mastering the <ul> Tag

When you browse the web, you're seeing <ul> elements everywhere, even when you don't realize it. The unordered list is one of the most fundamental and versatile tools for structuring content in HTML. It's the backbone of navigation menus, product feature lists, and much more. Mastering it means moving beyond just "bullet points" and understanding how to create semantic, accessible, and stylable content.

1. The Anatomy: Container and Items

A list is a two-part system. You can't have one without the other.

  • The Container (<ul>): This is the "Unordered List" tag. It wraps the *entire* set of items and tells the browser, "Everything inside here is part of a single list, and its order doesn't matter."
  • The Items (<li>): This is the "List Item" tag. Each <li> wraps a *single* item in the list. It **must** be a direct child of a <ul> (or<ol>) tag.
<ul>
  <li>Apples</li>
  <li>Oranges</li>
  <li>Bananas</li>
</ul>

2. The Most Important Concept: `ul` vs. `ol`

This is the core of list semantics. Choosing the right tag depends on one question: **Does the order matter?**

✔️ Use <ul> (Unordered)

When the items can be in any order.

  • A shopping list
  • A list of product features
  • Navigation links

✔️ Use <ol> (Ordered)

When the sequence is critical.

  1. Steps in a recipe
  2. Top 10 rankings
  3. Turn-by-turn directions

Using the wrong one is a semantic error. A screen reader might tell a user "Step 1: Milk, Step 2: Eggs" for a shopping list, which is confusing. Always ask if the sequence is part of the meaning.

3. The Power of Nesting

Lists become truly powerful when you "nest" them to create outlines and hierarchies. The rule is simple: **A new list (<ul> or<ol>) can be placed *inside* a list item (<li>).**

This is how all dropdown navigation menus are built.

<ul>
  <li>Fruits
    
    <ul>
      <li>Apple</li>
      <li>Banana</li>
    </ul>
  </li>
  <li>Vegetables
    <ul>
      <li>Carrot</li>
    </ul>
  </li>
</ul>

4. Styling with CSS: Beyond the Bullet

The default bullet point is just the beginning. CSS gives you full control.

  • list-style-type: none;: This is the magic property. It removes the bullet points entirely. It's step one for building a navigation bar.
  • list-style-type: square;: Changes the bullet to a square. You can also use `circle`.
  • display: flex;: By applying this to the <ul> tag, you can easily make your list items line up horizontally instead of vertically.

5. Accessibility: Why Lists Matter

This is non-negotiable. Using proper list tags is a critical accessibility feature. A screen reader will announce "List, 5 items" when it encounters a <ul>. This gives a visually impaired user immediate context that a group of related items is coming up. They can then use keyboard shortcuts to navigate between items or skip the list entirely.

If you just use `<p>` tags with a "*" or `<br>` tags, the user hears a jumble of disconnected text. You've removed all the structure and meaning.

Key Takeaway: Don't think of <ul> as a "bullet point tag." Think of it as a **"semantic grouping tag for related items where order is not important."** This shift in thinking will make you a better, more accessible, and more professional web developer.

HTML Lists Glossary

<ul> (Unordered List)
The container element for a list of items where the sequence or order does not matter. It tells the browser "this is a group of related items." Visually, it defaults to using bullet points.
<li> (List Item)
The tag used to define each individual item within a list. It must always be a direct child of a <ul>, <ol>, or `<menu>` tag.
<ol> (Ordered List)
The semantic alternative to <ul>. You must use this tag when the order of the items is important (e.g., steps in a recipe, a ranked list). It defaults to using numbers.
Nesting
The practice of placing a new list (<ul> or <ol>) inside of an <li> element to create a sub-list or hierarchy. This is the foundation for dropdown menus and outlines.
`list-style-type`
A CSS property used to control the appearance of the list marker. Common values for <ul> are `disc` (default), `circle`, `square`, and `none` (to remove bullets).
`list-style-image`
A CSS property that allows you to use a custom image as the bullet point for your list items.
Accessibility (A11y)
In the context of lists, this refers to using the correct <ul>and <li> tags so that assistive technologies (like screen readers) can understand the content's structure and announce it correctly to the user (e.g., "List, 3 items").

About the Author

Author's Avatar

TodoTutorial Team

Passionate developers and educators making programming accessible to everyone.

This article was written and reviewed by our team of web development experts, who have years of experience teaching HTML and building robust and accessible web applications.

Verification and Updates

Last reviewed: October 2025.

We strive to keep our content accurate and up-to-date. This tutorial is based on the latest HTML5 specifications and is periodically reviewed to reflect industry best practices.

External Resources

Found an error or have a suggestion? Contact us!