HTML Lists

HTML Lists: Organize with Clarity and Simplicity

When you want to present information in a structured, readable format — use a list. HTML gives you three types: ordered, unordered, and description lists. Each serves a distinct purpose, yet all contribute to better content clarity and flow.

Unordered Lists: The Bullet Point Classic

Unordered lists present items where order doesn’t matter — like a grocery list or a group of ideas. They use the <ul> tag (unordered list) and <li> tags for each list item.

<ul>
  <li>Apple</li>
  <li>Banana</li>
  <li>Cherry</li>
</ul>
Unordered Lists

This is perfect when the sequence doesn’t matter — you're just listing things out.

Ordered Lists: When Sequence Matters

Ordered lists are numbered — ideal for steps, rankings, or instructions. You’ll use the <ol> tag (ordered list) with <li> items.

<ol>
  <li>Wake up</li>
  <li>Eat an apple</li>
  <li>Go for a walk</li>
</ol>
Ordered Lists

Ordered lists imply priority or sequence. The browser numbers them automatically.

Description Lists: Pairing Terms with Definitions

Use a description list when you want to associate terms with descriptions — like in a glossary or FAQ. Use <dl> (description list), <dt> (description term), and <dd> (description definition).

<dl>
  <dt>Apple</dt>
  <dd>A red or green fruit that grows on trees.</dd>
  <dt>Banana</dt>
  <dd>A long, yellow fruit that peels easily.</dd>
</dl>
Description Lists

Description lists give structure to content that needs explanation. They’re perfect for presenting terms, concepts, and key-value information.

Nesting Lists: Lists Inside Lists

You can also nest lists inside other lists — useful for subcategories, tasks, or branching ideas. Let’s nest an unordered list inside an ordered one.

<ol>
  <li>Fruits
    <ul>
      <li>Apple</li>
      <li>Banana</li>
    </ul>
  </li>
  <li>Vegetables
    <ul>
      <li>Carrot</li>
      <li>Spinach</li>
    </ul>
  </li>
</ol>
Nesting Lists

Be mindful of indentation and closing tags — proper nesting keeps the structure readable and clean.

Best Practices for Using HTML Lists

  • Use ordered lists for sequences: instructions, steps, or rankings
  • Use unordered lists for loose groupings: categories, ideas, names
  • Use description lists for key-value pairs: definitions, FAQs
  • Keep nesting simple: deep nesting becomes hard to read

Summary

HTML lists are a versatile way to organize content, whether you're documenting a process or showcasing your favorite snacks. You now know how to:

  • Create unordered lists using <ul>
  • Create ordered lists using <ol>
  • Build description lists with <dl>, <dt>, and <dd>
  • Use nested lists for more complex hierarchies

Check your understanding 1

Which HTML tag is used to create an ordered list?
Choose one answer. You can try again.

Answer and explanation

<code><ol></code>

The <ol> tag is used for ordered lists where items are automatically numbered (1, 2, 3…). Unordered lists use <ul>, and <li> defines the list items within.

Check your understanding 2

The <li> tag can only be used inside <ul> elements.
Choose one answer. You can try again.

Answer and explanation

False

The <li> tag can be used within both <ul> (unordered) and <ol> (ordered) lists. It's a shared element for list items regardless of list type.

Check your understanding 3

Choose the option that lists all and only the correct statements.

  1. <dl>
  2. <dt>
  3. <dd>
  4. <li>
Which HTML elements are involved in creating a description list?
Choose one answer. You can try again.

Answer and explanation

Statements 1 and 2 and 3

A description list uses <dl> as the wrapper, <dt> for the term, and <dd> for the definition. <li> is not part of description list syntax.

Check your understanding 4

Which of the following HTML structure examples correctly represents a nested list?
Choose one answer. You can try again.

Answer and explanation

&lt;ul&gt; &lt;li&gt;Science &lt;ul&gt;&lt;li&gt;Physics&lt;/li&gt;&lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt;

The second option shows proper nesting — a <ul> inside a <li>. This creates a sublist under a specific item. Nesting outside <li> is invalid and leads to unpredictable rendering.

Check your understanding 5

Lists can only be styled using CSS, not modified in structure using HTML.
Choose one answer. You can try again.

Answer and explanation

False

HTML determines the structure of a list — whether ordered, unordered, or descriptive — while CSS styles how it looks. Structure changes like nesting or list type are done in HTML.

Check your understanding 6

Choose the option that lists all and only the correct statements.

  1. Ordered list for period sequence
  2. Unordered list for subjects under a period
  3. Description list for teacher details
  4. Preformatted list for layout
In a school timetable website, which list types would be suitable for the following? - A fixed period order - Subjects under each period - Teacher descriptions
Choose one answer. You can try again.

Answer and explanation

Statements 1 and 2 and 3

An <ol> fits fixed sequences (like periods), <ul> is great for item lists (like subjects), and <dl> is perfect for key-value descriptions (like teacher names and subjects taught).

What’s Next?

In the next tutorial, we’ll move from structure to interaction — learning how to create Links in HTML so users can navigate between pages, documents, and websites with ease.

Reaching the recap and completing the quizzes are separate milestones.

    Next lesson: HTML Links →