Post

Chapter 5.11 - The `<ul>` Element

Complete guide to the HTML `<ul>` element including unordered lists, list items, nesting, accessibility, CSS styling, DOM behavior, SEO, and professional best practices.

Chapter 5.11 - The `<ul>` Element

Chapter 5.11 — The <ul> Element

Lists are one of the fundamental ways humans organize information.

From navigation menus and product features to categories, tags, and summaries, websites rely heavily on lists to present information clearly.

HTML provides different types of list structures depending on the meaning of the content.

When the order of items does not matter, HTML uses the:

1
<ul>

element.

The letters “ul” stand for:

Unordered List

Unlike an ordered list (<ol>), an unordered list does not communicate sequence or priority.

The browser typically displays unordered lists using bullet markers.


5.11.1 Introduction to the <ul> Element

The <ul> element represents a collection of items where the order is not important.

Each individual item is represented using:

1
<li>

(List Item).

Basic syntax:

1
2
3
4
5
6
7
8
9
<ul>

<li>HTML</li>

<li>CSS</li>

<li>JavaScript</li>

</ul>

Browser output:

1
2
3
4
5
• HTML

• CSS

• JavaScript

The bullet symbol is generated automatically by the browser.

The author only defines the list items.


Why Use <ul> Instead of Manual Bullets?

Consider this example:

1
2
3
4
5
6
7
8
9
<p>

• HTML

• CSS

• JavaScript

</p>

Although it looks like a list, the browser sees only plain text.

Problems:

  • No semantic list structure.
  • Poor accessibility.
  • Difficult maintenance.
  • Search engines cannot understand the relationship between items.

The correct approach:

1
2
3
4
5
6
7
8
9
<ul>

<li>HTML</li>

<li>CSS</li>

<li>JavaScript</li>

</ul>

Now the browser understands that these items form a group.


Difference Between <ul> and <ol>

The key difference is meaning.

Ordered List

1
2
3
4
5
6
7
8
9
<ol>

<li>Install software</li>

<li>Configure settings</li>

<li>Start application</li>

</ol>

The sequence matters.

Changing the order changes the instructions.


Unordered List

1
2
3
4
5
6
7
8
9
<ul>

<li>HTML</li>

<li>CSS</li>

<li>JavaScript</li>

</ul>

The order does not matter.

The items are simply members of a collection.


Real-World Applications

The <ul> element is commonly used for:

  • Website navigation menus.
  • Feature lists.
  • Product benefits.
  • Categories.
  • Tags.
  • Social media links.
  • Footer links.
  • Search filters.
  • Sidebars.
  • Tool lists.
  • Technology stacks.

Example — Website Navigation

Navigation menus are usually unordered lists.

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
<nav>

<ul>

<li>Home</li>

<li>About</li>

<li>Contact</li>

</ul>

</nav>

Why <ul>?

Because navigation choices do not represent a sequence.


Example — Product Features

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<h2>

Features

</h2>

<ul>

<li>Fast performance</li>

<li>Responsive design</li>

<li>Secure architecture</li>

</ul>

Each feature is equally important.


Basic Structure

An unordered list contains:

  • One <ul> element.
  • One or more <li> elements.

Example:

1
2
3
4
5
6
7
<ul>

<li>Item One</li>

<li>Item Two</li>

</ul>

The <li> elements must belong to the list container.


Default Browser Rendering

Browsers usually display unordered lists with:

  • Bullet markers.
  • Left indentation.
  • Vertical spacing.

A simplified default style:

1
2
3
4
5
6
7
ul{

display:block;

padding-left:40px;

}

The exact bullet style depends on browser defaults.


Bullet Types

Historically, browsers supported different bullet styles:

  • Disc
  • Circle
  • Square

Example:

1
2
3
4
5
ul{

list-style-type:square;

}

Output:

1
2
3
4
5
▪ HTML

▪ CSS

▪ JavaScript

Modern websites often replace these with custom icons.


Nested Unordered Lists

An unordered list can contain another unordered list.

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<ul>

<li>

Frontend

<ul>

<li>HTML</li>

<li>CSS</li>

<li>JavaScript</li>

</ul>

</li>

<li>

Backend

</li>

</ul>

Rendered structure:

1
2
3
4
5
6
7
8
9
• Frontend

   • HTML

   • CSS

   • JavaScript

• Backend

Nested lists are useful for categories and subcategories.


Combining <ul> and <ol>

Lists can be combined depending on the meaning.

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<ul>

<li>

Installation

<ol>

<li>Download file</li>

<li>Install program</li>

</ol>

</li>

</ul>

The outer list represents categories.

The inner list represents ordered steps.


Common Misconceptions

Misconception 1

<ul> means the items are random.”

Incorrect.

It means the order has no semantic importance.


Misconception 2

“Bullets must always be visible.”

Incorrect.

CSS can remove or replace bullets while preserving semantic meaning.


Misconception 3

<ul> should be used for every list.”

Incorrect.

If the sequence matters, use <ol>.


Practical Exercise

Create a file named:

1
unordered-list.html

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>

<html lang="en">

<head>

<title>Unordered List Example</title>

</head>

<body>

<h2>

Web Technologies

</h2>

<ul>

<li>HTML</li>

<li>CSS</li>

<li>JavaScript</li>

<li>Jekyll</li>

</ul>

</body>

</html>

Open the page.

Observe that:

  • The browser creates bullet markers automatically.
  • The order of items is not important.
  • The structure is accessible.

Did You Know?

The <ul> element has existed since the earliest versions of HTML and remains one of the most frequently used elements on the modern web. Many complex interfaces—including navigation bars, menus, and dashboards—are built on top of unordered list structures enhanced with CSS and JavaScript.


Summary

In this section, you learned:

  • The purpose of the <ul> element.
  • Why unordered lists exist.
  • The relationship between <ul> and <li>.
  • Difference between <ul> and <ol>.
  • Basic syntax.
  • Browser rendering.
  • Nested lists.
  • Real-world applications.
  • Common mistakes.
  • Practical examples.

Coming Up Next — Section 5.11.2

In the next section, we will explore:

  • HTML Living Standard definition of <ul>.
  • Content categories.
  • Content model.
  • Browser parsing.
  • DOM representation.
  • HTMLUListElement interface.
  • List item rules.
  • Accessibility semantics.
  • Professional implementation techniques.

By the end of the next section, you will understand how browsers internally process unordered lists and how developers use them professionally.


This post is licensed under CC BY 4.0 by the author.