Set a numbering type for a list element
By default, an unordered list element (ul
) prepends any of its items a circle. Whereas an ordered list element (ol
) adds an auto-incremented number at the beginning of each item.
We can set or change the behavior by setting the list-style-type
property:
ol {
list-style-type: decimal;
}
ul {
list-style-type: disc;
}
However, the ul
and ol
elements come with a more powerful attribute named type
. It allows us to set the numbering type:
Attribute declaration | Items prefixed by |
---|---|
<ol type="a"> | a, b, c, ... |
<ol type="A"> | A, B, C, ... |
<ol type="i"> | i, ii, iii, ... |
<ol type="I"> | I, II, III, ... |
<!-- Items prefixed by a, b, c, ... -->
<ol type="a">
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>