Beginner LevelHTML & Semantic Web
What are the differences between ordered, unordered, and description lists in HTML?
❓ Interview Prompt: Compare <ol>, <ul>, and description lists (<dl>, <dt>, <dd>) and their semantic use cases.
HTML provides three distinct list elements:
1. Unordered List ('<ul>'):
Used for items where order does not matter (e.g. navigation links, feature bullets).
2. Ordered List ('<ol>'):
Used when item sequence matters (e.g. recipe steps, rankings).
3. Description List ('<dl>'):
Pairs term titles ('<dt>') with description values ('<dd>') (e.g. glossaries, metadata key-value pairs).
Code Implementation Example
html
<!-- Description List for key-value pairs -->
<dl>
<dt>HTML5</dt>
<dd>HyperText Markup Language 5th Revision</dd>
<dt>CSS3</dt>
<dd>Cascading Style Sheets Level 3</dd>
</dl>💡Structuring key-value metadata using description list (<dl>, <dt>, <dd>).
🎯 Interview Key Takeaway
Use <ul> for non-sequential items, <ol> for sequential steps, and <dl> for term-definition key-value pairs.
#Lists#ul#ol#dl#Beginner
Back to all HTML & Semantic Web Questions→