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?
Asked
Active
Viewed 8,371 times
3 Answers
10
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) ")";
}

mazlix
- 6,003
- 6
- 33
- 45

David Thomas
- 249,100
- 51
- 377
- 410
-
@FDisk: yes, did you read the first sentence? I imagine (though I don't have access in order to test) that it *should* work on IE 10 and, *possibly*, IE 9. – David Thomas Dec 19 '12 at 10:44
2
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>

Klaster_1 Нет войне
- 11,790
- 9
- 61
- 73
-
+1 for an answer I agree with, posted ahead of me (answering via iPhone takes so much time...). Had you posted your demo/example CSS *here* I'd've probably deleted my own, so very tardy, answer in deference to yours. – David Thomas Dec 08 '10 at 16:09
-