6

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?

sikas
  • 5,435
  • 28
  • 75
  • 120

3 Answers3

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>
0

No, the valid options are listed >here<.

TToni
  • 9,145
  • 1
  • 28
  • 42