Chapter 5 of 10
Lists are fundamental to almost every page on the web โ navigation menus, features, steps, ingredients, articles. HTML has three list types, each for a different purpose.
Use an unordered list <ul> when the order of items doesn't matter โ features, ingredients, navigation links. Items are wrapped in <li> (list item) tags.
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
<!-- Renders with bullet points by default -->Use an ordered list <ol> when sequence matters โ steps, instructions, rankings. The browser automatically numbers each item.
<ol>
<li>Install Node.js</li>
<li>Create a new project folder</li>
<li>Run npm init</li>
<li>Install packages</li>
</ol>
<!-- Renders: 1. Install Node.js 2. Create a new project... --><ul>
<li>Frontend
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</li>
<li>Backend
<ul>
<li>Node.js</li>
<li>Python</li>
</ul>
</li>
</ul><dl>
<dt>HTML</dt>
<dd>The markup language that structures web content.</dd>
<dt>CSS</dt>
<dd>The style language that controls appearance.</dd>
<dt>JavaScript</dt>
<dd>The programming language that makes pages interactive.</dd>
</dl>NOTE
Real-world usage. Navigation menus are almost always built with <ul> and <li> elements, then styled with CSS to look like horizontal bars, sidebars, or dropdowns. The semantic structure remains even when the visual appearance is completely transformed.