I recently encountered a problem where I created an ordered list containing over a hundred list items. I set list-style:decimal-leading-zero;
ol{ list-style: decimal-leading-zero; }
<ol> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> </ol> <p>...</p> <ol start="96"> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> <li>Some item</li> </ol>
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 and counters a> to achieve what you want here.
Reference Code: