HTML List Types tutorial shows how to create different structural forms of lists in HTML, including unordered, ordered, definition, and more.
last modified March 3, 2025
HTML List Types tutorial shows how to create different structural forms of lists in HTML, including unordered, ordered, definition, and more.
HTML Lists are used to organize and display items in a structured format. Introduced in early HTML, lists are essential for creating menus, outlines, and key-value pairs.
Lists can be structured in various ways depending on the data’s purpose. This tutorial covers different types of lists with examples rendered below each code snippet.
In the following examples, we explore different list structures with sample data. Basic CSS is included in the head for consistent styling.
A simple list with bullet points, using <ul> for unordered items.
Basic Unordered List Example
<ul> <li>Apple</li> <li>Banana</li> <li>Orange</li> <li>Grape</li> </ul>
Rendered output:
- Apple
- Banana
- Orange
- Grape
A numbered list using <ol> for ordered items.
Basic Ordered List Example
<ol> <li>First Step</li> <li>Second Step</li> <li>Third Step</li> <li>Fourth Step</li> </ol>
Rendered output:
1. $1
2. $1
3. $1
4. $1
An unordered list with sublists, showing hierarchy.
Nested Unordered List Example
<ul> <li>Fruits <ul> <li>Apple</li> <li>Banana</li> <li>Orange</li> </ul> </li> <li>Vegetables <ul> <li>Carrot</li> <li>Broccoli</li> <li>Spinach</li> </ul> </li> </ul>
Rendered output:
Fruits
- Apple
- Banana
- Orange
Vegetables
- Carrot
- Broccoli
- Spinach
An ordered list with numbered sublists, often used for outlines.
Nested Ordered List Example
<ol> <li>Chapter 1 <ol> <li>Section 1.1</li> <li>Section 1.2</li> <li>Section 1.3</li> </ol> </li> <li>Chapter 2 <ol> <li>Section 2.1</li> <li>Section 2.2</li> <li>Section 2.3</li> </ol> </li> </ol>
Rendered output:
Chapter 1
1. $1
2. $1
3. $1
Chapter 2
1. $1
2. $1
3. $1
A list of terms and descriptions using <dl>, <dt>, and <dd>.
Definition List Example
<dl> <dt>HTML</dt> <dd>HyperText Markup Language</dd> <dt>CSS</dt> <dd>Cascading Style Sheets</dd> <dt>JS</dt> <dd>JavaScript</dd> <dt>PHP</dt> <dd>PHP: Hypertext Preprocessor</dd> </dl>
Rendered output:
HTML
HyperText Markup Language
CSS
Cascading Style Sheets
JS
JavaScript
PHP
PHP: Hypertext Preprocessor
An unordered list styled horizontally using CSS.
Horizontal Unordered List Example
<ul style=“list-style: none; display: flex;"> <li>Home</li> <li>About</li> <li>Services</li> <li>Contact</li> </ul>
Rendered output:
- Home
- About
- Services
- Contact
An ordered list counting down using the reversed attribute.
Reversed Ordered List Example
<ol reversed> <li>Step 4</li> <li>Step 3</li> <li>Step 2</li> <li>Step 1</li> </ol>
Rendered output:
1. $1
2. $1
3. $1
4. $1
An ordered list with a custom numbering style using the type attribute.
Custom Marker Ordered List Example
<ol type=“A”> <li>Alpha</li> <li>Beta</li> <li>Gamma</li> <li>Delta</li> </ol>
Rendered output:
1. $1
2. $1
3. $1
4. $1
A combination of unordered and ordered lists for complex structures.
Mixed List Example
<ul> <li>Category A <ol> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ol> </li> <li>Category B <ol> <li>Item 4</li> <li>Item 5</li> <li>Item 6</li> </ol> </li> </ul>
Rendered output:
Category A
- Item 1
- Item 2
- Item 3
Category B
- Item 4
- Item 5
- Item 6
A definition list where terms have multiple descriptions.
Definition List with Multiple Descriptions Example
<dl> <dt>Python</dt> <dd>A programming language</dd> <dd>Created by Guido van Rossum</dd> <dt>Java</dt> <dd>A programming language</dd> <dd>Developed by Sun Microsystems</dd> </dl>
Rendered output:
Python
A programming language
Created by Guido van Rossum
Java
A programming language
Developed by Sun Microsystems
In this tutorial, we have explored various structural forms of HTML lists, demonstrating how to organize items in different layouts with visible examples.
List all HTML tutorials.