HTML provides three main types of lists:
1. Unordered List (<ul>)
Used when the order of items does not matter. Items are displayed with bullet points.
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Orange</li>
</ul>
Output:
- Apple
- Banana
- Orange
2. Ordered List (<ol>)
Used when the order of items is important. Items are displayed with numbers by default.
<ol>
<li>Wake up</li>
<li>Brush teeth</li>
<li>Eat breakfast</li>
</ol>
Output:
- Wake up
- Brush teeth
- Eat breakfast
You can change the numbering style:
<ol type="A">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ol>
type values:
-
1→ 1, 2, 3 (default) -
A→ A, B, C -
a→ a, b, c -
I→ I, II, III -
i→ i, ii, iii
3. Description List (<dl>)
Used for terms and their descriptions.
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets</dd>
</dl>
Output:
HTML
: HyperText Markup Language
CSS
: Cascading Style Sheets
Nested Lists
Lists can be placed inside other lists.
<ul>
<li>Fruits
<ul>
<li>Apple</li>
<li>Mango</li>
</ul>
</li>
<li>Vegetables</li>
</ul>
Summary
| List Type | Tag | Purpose |
|---|---|---|
| Unordered List | <ul> | Displays bulleted items |
| Ordered List | <ol> | Displays numbered or lettered items |
| Description List | <dl> | Displays terms and their descriptions |
| List Item | <li> | Defines an item in <ul> or <ol> |
| Description Term | <dt> | Defines a term in a description list |
| Description Details | <dd> | Defines the description of a term |
These are the basic HTML list elements you'll use to organize content effectively.

0 Comments