02. Lists and Types
Introduction
Section titled “Introduction”HTML provides three types of lists for organizing content: unordered lists, ordered lists, and definition lists. Each type serves a specific purpose and helps create structured, accessible content. Understanding when to use each list type is important for creating well-organized web pages.
List Types
Section titled “List Types”Unordered Lists (ul)
Section titled “Unordered Lists (ul)”For items without a specific order:
<ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li></ul>Ordered Lists (ol)
Section titled “Ordered Lists (ol)”For items with a specific order:
<ol> <li>First step</li> <li>Second step</li> <li>Third step</li></ol>Definition Lists (dl)
Section titled “Definition Lists (dl)”For term-definition pairs:
<dl> <dt>Term</dt> <dd>Definition</dd></dl>When to Use Each
Section titled “When to Use Each”Use ul for
Section titled “Use ul for”- Navigation menus
- Feature lists
- Unordered collections
- Bullet points
Use ol for
Section titled “Use ol for”- Step-by-step instructions
- Rankings
- Sequential processes
- Numbered items
Use dl for
Section titled “Use dl for”- Glossaries
- Metadata
- Term definitions
- Key-value pairs