Tag ol

The <ol> tag in HTML is used to define ordered (numbered) lists. It automatically numbers each list item, making it perfect for step-by-step instructionsrankingsrecipestask lists, or any content where the order matters.


📌 What Is the <ol> Tag?

The <ol> tag stands for “ordered list”, and it’s paired with <li> (list item) elements to define each point in the list.

Basic Syntax:

<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>

🟢 This will produce:

  1. First item
  2. Second item
  3. Third item

🧩 Structure Diagram

<ol>
├─ <li> Item 1 </li>
├─ <li> Item 2 </li>
└─ <li> Item 3 </li>
</ol>

✅ Use Cases for <ol>

Use CaseExample
Step-by-step instructionsRecipe, tutorial
Ordered task listTo-do app
Ranking or top 10 list“Top 5 Movies of 2025”
Chronological event listingTimeline or historical milestones

🔧 Attributes of <ol>

AttributeDescription
typeSpecifies the type of numbering (1AaIi)
startSets the starting number
reversedDisplays list in descending order

🧪 Example 1: Change List Type

<ol type="A">
<li>Apple</li>
<li>Banana</li>
<li>Cherry</li>
</ol>

🔠 Output:
A. Apple
B. Banana
C. Cherry


🧪 Example 2: Start at Custom Number

<ol start="5">
<li>Step Five</li>
<li>Step Six</li>
</ol>

Output:
5. Step Five
6. Step Six


🧪 Example 3: Reversed List

<ol reversed>
<li>Gold</li>
<li>Silver</li>
<li>Bronze</li>
</ol>

Output:
3. Gold
2. Silver

  1. Bronze

🎨 Styling <ol> with CSS

You can change the style of an ordered list using CSS:

<ol class="roman-list">
<li>Intro</li>
<li>Development</li>
<li>Conclusion</li>
</ol>

<style>
.roman-list {
list-style-type: upper-roman;
}
</style>

Output:
I. Intro
II. Development
III. Conclusion


📜 <ol> vs <ul>

Feature<ol><ul>
Ordered items✅ Yes❌ No (unordered bullets)
Use caseSteps, ranks, instructionsLists with no sequence
Styling optionsNumbers, letters, Roman numeralsBullets, custom markers

📶 Accessibility & SEO Tips

  • ✅ Use <ol> when order matters — screen readers announce the number
  • ✅ Helps users track steps in guides or forms
  • ✅ Adds semantic meaning to lists, boosting SEO

🧠 Bonus Tip: Use <li> content clearly and concisely for better readability and accessibility.


🏁 Conclusion

The <ol> tag is a simple yet powerful HTML tool for presenting sequential content in a structured, accessible, and readable way. From tutorials to rankings, it ensures your content is both visually clear and semantically meaningful.

⚡ Use <ol> whenever the order of items matters — your users and search engines will thank you.