HTML Notes
Master all HTML list types — unordered lists with bullets, ordered lists with numbers, description lists, nested lists, list item styling, and when to use each type with real-world examples.
Lists are one of the most versatile structures in HTML. They are used for navigation menus, bullet points, numbered steps, glossaries, product features, breadcrumbs, and more. HTML provides three types of lists, each suited to different content.
Ordered Lists <ol>
An ordered list displays items with sequential numbers. Use it when order matters — steps, rankings, procedures.
<ol>
<li>Open your text editor</li>
<li>Create a new file named index.html</li>
<li>Add the HTML boilerplate</li>
<li>Save and open in a browser</li>
</ol>Renders as:
- Open your text editor
- Create a new file named index.html
- Add the HTML boilerplate
- Save and open in a browser
Ordered List Attributes
type value | Style |
|---|---|
1 (default) | 1, 2, 3, 4 |
A | A, B, C, D |
a | a, b, c, d |
I | I, II, III, IV |
i | i, ii, iii, iv |
Tip: Prefer CSS list-style-type over the HTML type attribute for styling — keep content and presentation separate.
Custom Start Value on Individual Items
<ol>
<li value="10">Item 10</li>
<li>Item 11</li>
<li value="20">Jump to 20</li>
<li>Item 21</li>
</ol>Description Lists <dl>
A description list pairs terms with their descriptions. Useful for glossaries, metadata, FAQs, and key-value data.
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language — the standard language for web page structure.</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets — controls the visual presentation of HTML elements.</dd>
<dt>JavaScript</dt>
<dd>A programming language for web interactivity and dynamic behaviour.</dd>
</dl><dl>— the description list container<dt>— definition term (the key)<dd>— definition description (the value, indented)
Multiple Descriptions per Term
<dl>
<dt>HTTP Methods</dt>
<dd>GET — Retrieve data from the server</dd>
<dd>POST — Send data to the server</dd>
<dd>PUT — Update existing data on the server</dd>
<dd>DELETE — Remove data from the server</dd>
</dl>Multiple Terms per Description
<dl>
<dt>UK</dt>
<dt>United Kingdom</dt>
<dt>Britain</dt>
<dd>A country in northwestern Europe comprising England, Scotland, Wales, and Northern Ireland.</dd>
</dl>Real-World: Product Specifications
<dl>
<dt>Processor</dt>
<dd>Apple M3 Pro, 12-core CPU</dd>
<dt>Memory</dt>
<dd>18GB unified memory</dd>
<dt>Storage</dt>
<dd>512GB SSD</dd>
<dt>Display</dt>
<dd>14.2-inch Liquid Retina XDR, 3024×1964 resolution</dd>
<dt>Battery Life</dt>
<dd>Up to 18 hours</dd>
</dl>Nested Lists
Lists can be nested inside other list items to create hierarchies:
<ul>
<li>Frontend Development
<ul>
<li>HTML</li>
<li>CSS
<ul>
<li>Flexbox</li>
<li>Grid</li>
<li>Animations</li>
</ul>
</li>
<li>JavaScript</li>
</ul>
</li>
<li>Backend Development
<ul>
<li>Node.js</li>
<li>Python</li>
<li>Databases
<ul>
<li>PostgreSQL</li>
<li>MongoDB</li>
</ul>
</li>
</ul>
</li>
</ul>Important nesting rule: The nested <ul> or <ol> must be placed inside the <li> element, not after it:
Navigation Menus with Lists
Navigation menus are semantically built using <nav> + <ul> + <li> + <a>:
Using <ol> for breadcrumbs makes semantic sense — the order of the path matters.
Lists with Icons Using CSS
Modern web design replaces bullet dots with custom icons using CSS. The HTML remains clean:
<ul class="feature-list">
<li>Free forever plan with unlimited projects</li>
<li>No credit card required to get started</li>
<li>Cancel anytime, no questions asked</li>
</ul>.feature-list {
list-style: none;
padding: 0;
}
.feature-list li {
padding-left: 1.75rem;
position: relative;
}
.feature-list li::before {
content: "✓";
position: absolute;
left: 0;
color: green;
font-weight: bold;
}When to Use Which List Type
| Content | Best List Type | Reason |
|---|---|---|
| Step-by-step instructions | <ol> | Order is critical |
| Top 10 rankings | <ol> | Rank/order matters |
| Features, ingredients, items | <ul> | Order doesn't matter |
| Navigation menu | <nav> + <ul> | Unordered, accessible |
| Breadcrumb | <nav> + <ol> | Ordered path hierarchy |
| Glossary, FAQ, specs | <dl> | Term-description pairs |
| Table of contents | <ol> or <ul> | Depends on whether order matters |
Accessibility Notes
- Screen readers announce list items as "list, X items" — this is helpful for navigation
role="list"can be added if CSS removes native list semantics (some CSS resets do this)- Navigation lists should be inside
<nav>with anaria-label - Breadcrumb lists should mark the current page with
aria-current="page"
Summary
| Element | Purpose |
|---|---|
<ul> | Unordered list — items where order doesn't matter |
<ol> | Ordered list — items where sequence matters |
<dl> | Description list — term-definition pairs |
<li> | List item — used inside <ul> and <ol> |
<dt> | Definition term — used inside <dl> |
<dd> | Definition description — used inside <dl> |
Key attributes:
<ol start="n">— start numbering from n<ol reversed>— count down<ol type="A/a/I/i">— change numbering style<li value="n">— set specific number for that item
*Next: HTML Tables*
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for HTML Lists — Ordered, Unordered, and Description Lists.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this HTML Complete Guide topic.
Search Terms
html-complete-guide, html complete guide, html, complete, guide, basics, lists, html lists — ordered, unordered, and description lists
Related HTML Complete Guide Topics