I tried to use ordered list <ol>
and each list item <li>
outputs as 1. 2. 3. ... etc, I want the output to be 1) 2) 3) ... etc, can this be done?
To create ordered list in HTML, use the <ol> tag. Ordered list starts with the <ol> tag. The list item starts with the <li> tag and will be marked as numbers, lowercase letters uppercase letters, roman letters, etc.
In HTML, we can create an ordered list using the <ol> tag. The ol in the tag stands for an ordered list. Inside each of the ordered list elements <ol> and <ol /> , we have to define the list items. We can define the list items using the <li> tag.
Answer: Type attribute allows us to change the style of numbers in an ordered list. Explanation: The < li > tag includes two attributes – type and value. The type attribute is used to modify the order numbering in the list item.
You can, but only with the more up-to-date browsers (Chrome, Safari, Firefox and Opera will work):
ol {
counter-reset: listCounter;
}
ol li {
counter-increment: listCounter;
}
ol li:before {
content: counter(listCounter) ")";
}
You can do this with CSS counter and pseudo elements:
ol li{
list-style: none;
counter-increment: myIndex;
}
ol li:before{
content:counter(myIndex)") ";
}
<ol>
<li>test</li>
<li>test</li>
<li>test</li>
<li>test</li>
<li>test</li>
</ol>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With