I recently encountered a problem where I created an ordered list containing over a hundred list items. I setlist-style:decimal-leading-zero;
ol{ list-style: decimal-leading-zero; }
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
...
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
- Some item
Problem:Only the first nine list items have leading zeros.
Expected:Two leading zeros in the first nine list items, and one leading zero in the 10th to 99th list items.
There is no
list-style
for three decimal places.However, you can use pseudo-selectors andcounters a> to achieve what you want here.
Reference Code: