Loading...
Loading...
Organize items into bullet points or numbered lists
Lists group related items together. HTML supports two types: unordered lists () with bullet points, and ordered lists () with numbers. Each item inside is wrapped in (list item).
<!-- Unordered list (bullets) -->
<ul>
<li>Apples</li>
<li>Bananas</li>
<li>Cherries</li>
</ul>
<!-- Ordered list (numbers) -->
<ol>
<li>Mix ingredients</li>
<li>Bake for 30 minutes</li>
<li>Let cool</li>
</ol>| Element | What it does |
|---|---|
| `<ul>` | Unordered list — items appear with bullet points |
| `<ol>` | Ordered list — items appear numbered (1, 2, 3...) |
| `<li>` | A single item in the list (must be inside `<ul>` or `<ol>`) |
You can put lists inside lists for hierarchies:
<ul>
<li>Fruits
<ul>
<li>Apples</li>
<li>Oranges</li>
</ul>
</li>
<li>Vegetables
<ul>
<li>Carrots</li>
<li>Broccoli</li>
</ul>
</li>
</ul>Renders as:
- Apples
- Oranges
- Carrots
- Broccoli
<ul>
<li><a href="/home">Home</a></li>
<li><a href="/about">About</a></li>
<li><a href="/contact">Contact</a></li>
</ul>| Attribute | Shows | Example |
|---|---|---|
| `<ol>` | 1, 2, 3... | Default |
| `<ol type="A">` | A, B, C... | Steps in a recipe |
| `<ol type="i">` | i, ii, iii... | Roman numerals |
| `<ol start="5">` | 5, 6, 7... | Start from a number |
| ❌ Wrong | Why | ✅ Right |
|---|---|---|
| `<li>` without `<ul>` or `<ol>` | List items must be inside a list container | `<ul><li>Item</li></ul>` |
| `<ul><li>Item</ul></li>` | Wrong nesting — closing tags must mirror opening | `<ul><li>Item</li></ul>` |
| `<ul><p>Item</p></ul>` | Only `<li>` can be direct child of `<ul>`/`<ol>` | `<ul><li>Item</li></ul>` |
Create a page with:
<h1>My Daily Routine</h1> <h2>Morning Routine</h2> <ol> <li>Wake up</li> <li>Brush teeth</li> <li>Have breakfast</li> </ol> <h2>To-Do List</h2> <ul> <li>Study HTML</li> <li>Practice coding</li> <li>Read a book</li> </ul>