2

http://jsbin.com/urice

I want to remove . after number.

1. should be 1 only

With All browser compatibility inducing IE6 and validity.

I need solution without javascript.

Edit :

If it's not possible with css only then a simple javascript and jQuery solution would be appreciated, thanks.

David Thomas
  • 249,100
  • 51
  • 377
  • 410
Jitendra Vyas
  • 148,487
  • 229
  • 573
  • 852

3 Answers3

3

There is this, not sure how many browsers support it though.

ol {
list-style-type:none;
} 

ol li:before {
content:counter(number) " ";
counter-increment:number;
counter-reset: number;
}

Working example here. I have it working in Chrome.

Kyle
  • 65,599
  • 28
  • 144
  • 152
1

Honestly, the only way do what you want completely cross browser is to not use the list numbering at all. Just put list-style:none on the list and type the numbers manually:

<ol>
  <li>1 The first item</li>
  <li>2 The second item</li>
</ol>

If you're generating code server-side, then it's a lot easier since you can use an incrementing variable in your loop.

DisgruntledGoat
  • 70,219
  • 68
  • 205
  • 290
0

Using jQuery to find the < li > and inserting an incrementing number into their .innerHTML is probably the best way to do this using javascript.

cazlab
  • 788
  • 5
  • 17