Lists are everywhere on the web — navigation menus, step-by-step guides, shopping lists, glossaries. HTML has three list types.
<ol>)An ordered list numbers its items automatically. Use it when sequence matters:
<ol>
<li>Preheat the oven to 180°C</li>
<li>Mix the ingredients</li>
<li>Pour into a baking tin</li>
<li>Bake for 30 minutes</li>
</ol>
Output:
<ul>)An unordered list uses bullets (or other markers). Use it when order does not matter:
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Orange</li>
</ul>
Output:
<dl>)A description list pairs terms with their definitions. Use it for glossaries, FAQs, and metadata:
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language — structures web content.</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets — styles web content.</dd>
<dt>JavaScript</dt>
<dd>A programming language that adds interactivity.</dd>
</dl>
| Tag | Role |
|---|---|
<dl> | Description List wrapper |
<dt> | Description Term |
<dd> | Description Details (indented by default) |
You can nest a list inside an <li> to create sub-items:
<ul>
<li>Front-end
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</li>
<li>Back-end
<ul>
<li>Python</li>
<li>Node.js</li>
</ul>
</li>
</ul>
Build a page that uses all three list types:
<ol> to the page.<ol>, add at least 3 <li> steps.<ul> to the page.<ul>, add at least 3 <li> items.<dl> to the page.<dl>, add at least 2 <dt> terms (with matching <dd> definitions).Use <ol> for ordered (numbered) lists and <ul> for unordered (bullet) lists.