HTML5 Lists
HTML
What is a List in HTML5?
A list is a way to group related pieces of content together. HTML5 supports three main types of lists:
- Ordered Lists (
<ol>
) – items are numbered (or lettered). - Unordered Lists (
<ul>
) – items have bullet points. - Description Lists (
<dl>
) – used for pairs of terms and descriptions (like a glossary).
1. Ordered List (<ol>
)
Items are in a specific sequence. Each item is marked with a number by default.
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Output:
- First item
- Second item
- Third item
You can change the type of numbering (e.g. letters, roman numerals):
<ol type="A">
<li>Item A</li>
<li>Item B</li>
</ol>
Output:
- Item A
- Item B
2. Unordered List (<ul>
)
Items have bullets. No order is implied.
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Cherry</li>
</ul>
Output:
- Apple
- Banana
- Cherry
You can change the bullet style with CSS (e.g. list-style-type: circle;
).
3. Description List (<dl>
)
Used for terms and their descriptions, like in dictionaries or FAQs.
<dl>
<dt>HTML</dt>
<dd>A markup language for creating web pages.</dd>
<dt>CSS</dt>
<dd>A style sheet language for designing web pages.</dd>
</dl>
Output:
- HTML
- A markup language for creating web pages.
- CSS
- A style sheet language for designing web pages.