HTML Lists
HTML provides three main types of lists to organize content: ordered lists, unordered lists, and description lists.
1. Ordered List (<ol>
)
Used when the order of items matters (e.g., instructions, rankings).
<ol>
<li>Step one</li>
<li>Step two</li>
<li>Step three</li>
</ol>
2. Unordered List (<ul>
)
Used when the order doesn't matter (e.g., a list of features or items).
<ul>
<li>Apples</li>
<li>Bananas</li>
<li>Oranges</li>
</ul>
3. Description List (<dl>
)
Used to describe terms and definitions, like in glossaries or FAQs.
<dl>
<dt>HTML</dt>
<dd>The standard markup language for creating web pages.</dd>
<dt>CSS</dt>
<dd>A language used to style HTML documents.</dd>
</dl>
Best Practices
- Use
<ol>
when order is important. - Use
<ul>
for general groupings. - Use
<dl>
for key-value or term-definition style content.