-
The
olelement represents a list of items, where the items have been intentionally ordered - Typically rendered as a numbered list
-
The items of the list are the
lielement child nodes of theolelement
ol element represents a list of items,
where the items have been intentionally ordered
li element child nodes of
the ol element
reversed
reversed attribute is a boolean attributestart
start attribute, if present, must be a valid integertype attribute can be used to specify the kind of marker to
use in the list
| Keyword | State | Description | Example |
|---|---|---|---|
| 1 | decimal | decimal number | 1. 2. 3. |
| a | lower-alpha | lowercase latin alphabet | a. b. c. |
| A | upper-alpha | uppercase latin alphabet | A. B. C. |
| i | lower-roman | lowercase roman numerals | i. ii. iii. |
| I | upper-roman | uppercase roman numerals | I. II. III. |
start vs value
value,
as an attribute of the
li tag,
may be used instead of start
start attribute of ul
li tagsvalue must be an integer,
even if the list is displayed with Roman numerals or letters
value attribute has no meaning for unordered listsli value attribute indicates the current ordinal
value of the list item as defined by the ol element
upper-alpha and upper-latin are identicallower-latin and lower-alpha are identicalstart vs value)
<ol start="2">
<li>d</li>
<li>d</li>
<li value="100">d</li>
<li>d</li>
<li>d</li>
</ol>
value overrides start
and increments
<ol start="10" reversed>
<li>d</li>
<li>d</li>
<li value="100">d</li>
<li>d</li>
</ol>
<ol start="2" type="I">
<li>d</li>
<li>d</li>
<li value="10">d</li>
<li>d</li>
</ol>
<ol start="2" type="i">
<li>d</li>
<li>d</li>
<li>d</li>
<li>d</li>
</ol>
<ol type="a">
<li>d</li>
<li>d</li>
<li>d</li>
<li>d</li>
</ol>
<ol type="A">
<li>d</li>
<li>d</li>
<li>d</li>
<li>d</li>
</ol>
list-style-type)
<ol>
<li>d</li>
<li>d</li>
<li>d</li>
<li>d</li>
<li>d</li>
</ol>
ol {
list-style-type: decimal-leading-zero;
}
ol>li:first-of-type {
list-style-type: decimal;
}
ol>li:nth-of-type(2) {
list-style-type: lower-greek;
}
list-style-type)
<ol>
<li>d</li>
<li>d</li>
<li>d</li>
<li>d</li>
</ol>
ol {
list-style-type: upper-roman;
}
ol>li:first-of-type {
list-style-type: lower-roman;
}
ol>li:nth-of-type(2) {
list-style-type: upper-alpha;
}
ol>li:nth-of-type(3) {
list-style-type: lower-alpha;
}
<ol>
<li>a
<li>
<ol>
<li>b
<li>b
<ol>
<li>c
<li>c
<ol>
<li>d
<li>d
<li>d
</ol>
<li>c
</ol>
<li>b
</ol>
<li>a
<li>a
</ol>
ul)