HTML
Module 6: Lists and Grouped Content
Unordered and Ordered Lists
Choose ul or ol based on whether the sequence of items matters.
6 minute lessonBeginner to advanced
Use an unordered list when the items form a group but their order is not important. Use an ordered list when sequence or ranking matters.
<h2>What to bring</h2>
<ul>
<li>Notebook</li>
<li>Water bottle</li>
<li>Charging cable</li>
</ul>
<h2>Setup steps</h2>
<ol>
<li>Create a project folder.</li>
<li>Add an index.html file.</li>
<li>Open the file in a browser.</li>
</ol>
Each list item belongs inside li. Do not use a list simply because you want bullets on screen; the items should genuinely form a list. CSS can change the marker style without changing whether the list is ordered or unordered.
The start attribute sets an ordered list’s starting number. reversed counts down, and an individual li can use value to set its number. Use these attributes when a numbered sequence continues across sections rather than typing numbers manually into each item.