Skip to main content

Command Palette

Search for a command to run...

HTML Lists (`<ul>`, `<ol>`, `<li>`): A Complete Beginner's Guide

Updated
2 min read
M
Hi, I'm Subhash Singh, a Computer Science student passionate about web development, programming, and technology. I share simple and beginner-friendly content to help others learn and grow.

Introduction

Lists are one of the most commonly used elements in HTML. They help organize information in a clean and structured way, making web pages easier to read and understand.

In this article, you'll learn about unordered lists, ordered lists, and list items with practical examples.


What are HTML Lists?

HTML lists are used to group related items together.

There are mainly two types of lists:

  • Unordered List (<ul>)
  • Ordered List (<ol>)

Each item inside a list is created using the <li> tag.


Unordered List (<ul>)

An unordered list displays items with bullet points.

Example

<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>

Output

  • HTML
  • CSS
  • JavaScript

Ordered List (<ol>)

An ordered list displays items with numbers.

Example

<ol>
  <li>Wake Up</li>
  <li>Study HTML</li>
  <li>Practice Coding</li>
</ol>

Output

  1. Wake Up
  2. Study HTML
  3. Practice Coding

The <li> Tag

The <li> tag stands for List Item and is used inside both <ul> and <ol>.

Example:

<ul>
  <li>Apple</li>
  <li>Mango</li>
  <li>Orange</li>
</ul>

Why Use Lists?

  • Organize information neatly
  • Improve readability
  • Make navigation easier
  • Display menus and features
  • Enhance user experience

Best Practices

  • Use ordered lists when sequence matters.
  • Use unordered lists when order doesn't matter.
  • Keep list items short and meaningful.
  • Avoid unnecessary nesting for beginners.

Conclusion

HTML lists make web pages more organized and user-friendly. Every web developer should understand how to use <ul>, <ol>, and <li> effectively.


Frequently Asked Questions (FAQs)

1. What is an unordered list?

It is a list that displays bullet points using the <ul> tag.

2. What is an ordered list?

It is a numbered list created using the <ol> tag.

3. What does <li> stand for?

<li> stands for List Item.

4. Can I use <li> without <ul> or <ol>?

No. It should be placed inside a list container like <ul> or <ol>.