HTML Lists
Master HTML lists to organize and present information clearly. Learn unordered, ordered, and description lists with practical examples.
What types of lists are there in HTML?
HTML has three list types: unordered lists (<ul>) for bullet points, ordered lists (<ol>) for numbered steps, and description lists (<dl>) for term–definition pairs. Each item in <ul> and <ol> goes in an <li>, and items can contain nested lists.
<ul>
<li>HTML</li>
<li>CSS</li>
</ul>
<ol start="1" type="1">
<li>Write code</li>
<li>Test it</li>
</ol>
<dl>
<dt>HTML</dt>
<dd>The structure of a web page.</dd>
</dl>Why Use HTML Lists?
HTML lists organize related content in a structured, readable format. They improve accessibility, SEO, and user experience by providing semantic meaning to grouped information.
List Benefits:
- Accessibility: Screen readers navigate lists easily
- SEO: Search engines understand content structure
- Styling: Easy to style with CSS
- Semantics: Clear content relationships
Types of HTML Lists
1. Unordered Lists (<ul>)
Use when order doesn't matter. Items are typically displayed with bullet points.
Structure:
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>Best For:
- • Shopping lists
- • Feature lists
- • Navigation menus
- • Related items
2. Ordered Lists (<ol>)
Use when order matters. Items are numbered automatically by the browser.
Structure:
<ol>
<li>First step</li>
<li>Second step</li>
<li>Third step</li>
</ol>Best For:
- • Instructions/recipes
- • Rankings/top lists
- • Sequential processes
- • Numbered items
3. Description Lists (<dl>)
Use for term-definition pairs. Consists of terms (<dt>) and descriptions (<dd>).
Structure:
<dl>
<dt>Term</dt>
<dd>Definition</dd>
<dt>Another term</dt>
<dd>Another definition</dd>
</dl>Best For:
- • Glossaries
- • FAQs
- • Name-value pairs
- • Definitions
Interactive Lists Example
Try this comprehensive example showing all three types of HTML lists:
Code Editor
<h3>Unordered</h3>
<ul><li>HTML</li><li>CSS</li><li>JavaScript</li></ul>
<h3>Ordered</h3>
<ol><li>Write</li><li>Test</li><li>Ship</li></ol>
<h3>Nested</h3>
<ul>
<li>Frontend
<ul><li>HTML</li><li>CSS</li></ul>
</li>
</ul>
<h3>Description list</h3>
<dl><dt>HTML</dt><dd>Structure of a page.</dd></dl>Preview
Advanced List Features
Nested Lists
<ul>
<li>Main item 1
<ul>
<li>Sub item 1</li>
<li>Sub item 2</li>
</ul>
</li>
<li>Main item 2</li>
</ul>Perfect for hierarchical content like site navigation or category structures.
Ordered List Attributes
type="1" Numbers (default)type="A" Uppercase letterstype="a" Lowercase lettersstart="5" Start from number 5CSS List Styling
ul {
list-style-type: disc; /* circle, square, none */
}
ol {
list-style-position: inside; /* outside */
}
li {
margin-bottom: 8px;
padding: 4px 0;
}Semantic Guidelines
- • Use lists for related items only
- • Don't use lists for layout purposes
- • Consider accessibility when styling
- • Use nested lists for hierarchies
- • Each list item should be meaningful
List Best Practices
✅ Best Practices:
- Choose the right list type for content
- Keep list items concise and focused
- Use parallel structure in list items
- Consider accessibility in styling
❌ Common Mistakes:
- • Using lists only for visual styling
- • Mixing different content types in one list
- • Not providing enough list items
- • Incorrect nesting structure
- • Removing list semantics with CSS
- • Using wrong list type for content
Your Learning Path
Master HTML lists for organized content
What You've Learned
- ▶Unordered lists with various bullet styles
- ▶Ordered lists with numbering systems
- ▶Description lists for term definitions
- ▶Nested lists for complex structures
- ▶List styling and customization
What's Next
- ▶HTML Links - Navigate between pages
- ▶HTML Images - Embed visual content
- ▶HTML Tables - Structure tabular data
- ▶HTML Forms - Collect user input
- ▶CSS Styling - Make your lists beautiful
Pro Learning Tip
Lists are fundamental for organizing content. Use unordered lists for items without sequence, ordered lists for steps or rankings, and description lists for glossaries or FAQs.
HTML Lists — step by step
Create unordered lists
The ul element creates a bulleted list. Each item goes in a li element. Use unordered lists when the sequence of items doesn't matter.
🎯 Quick Check
Which HTML list element should you use when the order of items matters?
HTML Lists: summary
Key points
- Navigation menus are usually a
<ul>of links inside<nav>. <ol>supportsstart,reversedandtype(1,a,A,i,I).- Only
<li>elements can be direct children of<ul>and<ol>. - Screen readers announce the number of items in a list, which helps users orient themselves.
Frequently asked questions
›How do I make a nested list?
Put a new <ul> or <ol> inside an <li>, not directly inside the parent list.
›How do I remove bullet points?
With CSS: ul { list-style: none; padding: 0; }.