Interesting Facts About HTML Lists
Last Updated :
23 Jul, 2025
HTML lists are a fundamental part of web development, used to organize and present information in a structured and readable format. While they may seem simple, HTML lists have some interesting features and nuances that make them versatile and powerful.
1. Definition Lists for Metadata
The <dl> element isn’t just for glossaries—it’s ideal for structuring key-value pairs like metadata, settings, or attributes. Each <dt> (term) can have multiple <dd> (descriptions), creating semantic relationships.
HTML
<dl>
<dt>Author</dt>
<dd>J.K. Rowling</dd>
<dt>Published</dt>
<dd>1997</dd>
<dd>Bloomsbury (UK)</dd>
</dl>
2. CSS Counters for Multi-Level Numbering
CSS counters (counter-reset, counter-increment) allow custom hierarchical numbering (e.g., 1.1, 1.2) in nested lists, overriding default browser behavior.
HTML
<style>
ol { counter-reset: section; list-style: none; }
li::before {
counter-increment: section;
content: counters(section, ".") " ";
}
</style>
<ol>
<li>Chapter 1
<ol>
<li>Subsection 1.1</li>
</ol>
</li>
</ol>
3. Override Numbering with value
The value attribute in <li> lets you restart or skip numbering mid-list in ordered lists.
HTML
<ol>
<li>Step 1</li>
<li value="4">Step 4 (skipped 2-3)</li>
<li>Step 5</li>
</ol>
4. Reverse-Numbered Lists with Semantic Meaning
The reversed attribute in <ol> decrements numbering (e.g., 5, 4, 3) while maintaining semantic order in the DOM. Assistive technologies announce items in visual order.
HTML
<ol reversed start="5">
<li>Phase 5: Launch</li>
<li>Phase 4: Testing</li>
</ol>
5. Cross-List Number Continuity with start
The start attribute attribute resumes numbering across separate <ol> elements, mimicking a single continuous list.
HTML
<ol start="3">
<li>Chapter 3</li>
</ol>
<!-- Later in the document -->
<ol start="4">
<li>Chapter 4</li>
</ol>
6. Mid-List Number Override with value
The value attribute attribute on <li> forces a specific number, overriding the default sequence. Subsequent items follow the new value.
HTML
<ol>
<li>Step 1</li>
<li value="10">Step 10 (skip ahead)</li>
<li>Step 11</li> <!-- Continues from 10 -->
</ol>
7. Accessible Inline Navigation Menus
Convert vertical lists to horizontal menus using CSS while preserving semantics for screen readers.
HTML
<style>
.nav-list {
list-style: none;
padding: 0;
display: flex;
gap: 2rem;
}
</style>
<ul class="nav-list">
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
</ul>
8. Start Lists at a Specific Number
The start attribute forces ordered lists to begin at a custom number.
HTML
<ol start="5">
<li>Item 5</li>
<li>Item 6</li>
</ol>
9. Shadow DOM List Encapsulation
Lists inside Shadow DOM components retain their styles without global CSS interference.
HTML
<script>
const shadow =
document.querySelector('#host').attachShadow({ mode: 'open' });
shadow.innerHTML = `
<style>ul { color: blue; }</style>
<ul>
<li>Isolated list item</li>
</ul>
`;
</script>
<div id="host"></div>
Explore
HTML Basics
Structure & Elements
Lists
Visuals & Media
Layouts & Designs
Projects & Advanced Topics
Tutorial References