LEARNING OBJECTIVES ⌵
- Master the 5 valid values of the
typeattribute on<ol>(1,a,A,i,I). - Use the
startattribute to begin list numbering from arbitrary positive, zero, or negative integer offsets. - Understand how
startinteracts with alphabetic and Roman numeraltypesystems. - Implement manual numbering overrides using the
valueattribute on individual<li>elements. - Differentiate between semantic numbering requirements (HTML attributes) and purely visual styling (CSS).
📖 The Mental Model & Story (Intuitive Foundation)
Imagine drafting an enterprise software contract or a multi-part university examination.
In a legal agreement, Article I covers Definitions, Article II covers Intellectual Property, and Article III covers Termination. Within Section III, specific sub-clauses are referenced as (a), (b), and (c), while fine-print statutory references are labeled (i), (ii), and (iii).
+-------------------------------------------------------------+
| LEGAL CONTRACT TAXONOMY |
+-------------------------------------------------------------+
|
+--> Section I: Definitions (Uppercase Roman)
| +--> Clause a: Terms (Lowercase Alpha)
| +--> Clause b: Jurisdiction
| +--> (i) Federal Court (Lowercase Roman)
| +--> (ii) Arbitration
|
+--> Section II: Intellectual Property
Furthermore, imagine a long procedure split across two printed pages or interrupted by a full-width diagram. The first page contains steps 1 through 5. The second page must resume seamlessly at Step 6, not restart at Step 1.
The HTML <ol> element provides built-in semantic attributes—type, start, and the list-item-specific value—to handle complex numbering schemes and discontinuous sequences directly in the markup.
Technical Deep Dive & Specifications
The type Attribute Values
The type attribute on <ol> defines the numbering format. Under WHATWG specifications, it accepts exactly 5 single-character values:
type Value |
Numbering Style | Sequence Example | Common Use Case |
|---|---|---|---|
1 |
Decimal numerals (default) | 1, 2, 3, 4, 5... | Standard procedures, step-by-step guides |
a |
Lowercase Latin alphabet | a, b, c, d, e... | Multiple choice options, sub-clauses |
A |
Uppercase Latin alphabet | A, B, C, D, E... | Major document sections, appendices |
i |
Lowercase Roman numerals | i, ii, iii, iv, v... | Preface pagination, statutory footnotes |
I |
Uppercase Roman numerals | I, II, III, IV, V... | Legal articles, legislative acts, movie acts |
[!NOTE] While CSS
list-style-typecan also change visual markers, the HTMLtypeattribute retains semantic meaning when CSS fails to load, in plain-text web scrapers, and in syndicated RSS/Atom feeds.
The start Attribute: Integer Offsets
The start attribute defines the ordinal value for the first <li> in the list.
Critical Rule: The start attribute MUST ALWAYS be specified as an integer in decimal format, regardless of the type attribute being used.
<!-- ✅ CORRECT: Starts at 'e' (5th letter) because start is decimal 5 -->
<ol type="a" start="5">
<li>Item 'e'</li>
<li>Item 'f'</li>
</ol>
<!-- ✅ CORRECT: Starts at 'V' (5th Roman numeral) -->
<ol type="I" start="5">
<li>Section V</li>
<li>Section VI</li>
</ol>
<!-- ❌ INVALID: Browsers will ignore non-integer strings -->
<ol type="a" start="e"> ... </ol>
The value Attribute on <li>
While start configures the entire <ol>, the value attribute allows an individual <li> to override its own ordinal number and reset the counter progression for all subsequent siblings.
<ol start="1">
<li>Item 1</li> --> Ordinal: 1
<li>Item 2</li> --> Ordinal: 2
<li value="10">Item 10</li> --> Overrides counter to 10
<li>Item 11</li> --> Automatically increments from 10 to 11
<li>Item 12</li> --> Automatically increments to 12
</ol>
[ol start="1"]
├── <li> (1)
├── <li> (2)
├── <li> value="10" (10) <-- JUMP OVERRIDE
├── <li> (11) <-- Automatic continuation
└── <li> (12)
💻 Interactive Code Playground
Starter Code
Line-by-Line Code Breakdown
- Line 40:
<ol type="I" start="4">configures uppercase Roman numerals starting at IV (decimal4). - Lines 41–46: Items render automatically as IV. and V.
- Lines 48–50: An
<aside>box interrupts the list structure with editorial commentary. - Line 54:
<ol type="I" start="6">creates a second list that cleanly resumes numbering at VI. (decimal6). - Line 65:
<ol type="a">creates a lowercase alphabetic sub-list rendering as a., b., and c.
Expected Browser Render Output
================================================================
Master Infrastructure Agreement
================================================================
Article IV: Uptime Commitments
IV. Core Service Availability: Provider guarantees 99.99%...
V. Scheduled Maintenance Windows: Routine patching...
[ Notice: Maintenance windows exceeding 120 minutes... ]
Article IV (Continued): Financial Remedies
VI. Service Credits: Downtime exceeding 0.01% generates...
VII. Chronic Outage Termination: Outages exceeding 4 hours...
Section 7.1 Multi-Choice Penalty Schedule
a. Tier 1 breach: 5% monthly fee credit.
b. Tier 2 breach: 15% monthly fee credit.
c. Tier 3 breach: 50% monthly fee credit.🏋️ Hands-On Exercise
🎯 The Challenge: Split Examination Paper
You are building the online examination interface for a certification test. The exam is divided into two sections by an informational banner.
- Section 1: Contains Questions 1 through 3.
- An informational banner sits between the sections.
- Section 2: Must resume starting at Question 4.
- Inside Question 4, there are 3 multiple-choice options labeled (a), (b), and (c).
- Question 5 has a jump in grading reference: its sub-clauses must use lowercase Roman numerals (i), (ii), (iii) starting at index (iv) (decimal offset 4).
Instructions:
- Structure Section 1 as an
<ol>. - Insert the informational banner.
- Structure Section 2 as an
<ol>with the appropriatestartattribute so it begins at Question 4. - Nest the multiple-choice options inside Question 4 using
<ol type="a">. - Nest the Roman sub-clauses inside Question 5 using
<ol type="i" start="4">.
🏁 Starter Code Sandbox
⚠️ Common Pitfalls
- Using Non-Numeric Strings in
start: Writing<ol type="a" start="c">is invalid HTML. The parser ignores"c"and defaultsstartto1(which rendersa). Always pass decimal integers:<ol type="a" start="3">. - Using the Obsolete
compactorclearAttributes: These HTML4 presentational attributes were deprecated in HTML5. Use CSS for layout spacing. - Using
valuewith Non-Integer Strings: Writing<li value="x">is invalid. Always supply integers:<li value="24">.
💡 Pro Tips
- Negative Start Offsets: The
startattribute fully supports zero and negative integers!<ol start="-2">produces markers:-2.,-1.,0.,1.,2.. This is extremely useful in mathematical countdowns, temperature indices, or relative benchmark rankings. - Print Stylesheet Resilience: For generated PDF invoices and paginated print stylesheets (
@media print), using<ol start="...">allows backend reporting tools to split a 1,000-item invoice across 20 distinct printed pages while maintaining exact line-item numbering continuity.
📌 Key Takeaways
- The
typeattribute on<ol>accepts five valid values:'1','a','A','i', and'I'. - The
startattribute MUST always be a decimal integer, even when using alphabetic or Roman numeral types (e.g.,start="3"withtype="I"yieldsIII). <ol start="N">allows ordered lists to resume numbering across intermediate layout breaks, banners, or page splits.- The
<li value="N">attribute can override the counter at any specific item, and subsequent siblings will automatically increment from that new value. - Negative integers and zero are valid values for
startandvalue. - --