views:

150

answers:

3

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.

+3  A: 

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 Sevenoaks
Doesn't match the criteria for IE6 compatibility though. Certianly not without js.
David Thomas
it's not working on IE 6 and 7
metal-gear-solid
@ricebowl - you can give javascript solution if it's not possible using css only
metal-gear-solid
Aye, I kinda figured IE wouldn't support it. But at least it's an option for the real browsers, then could just use some JS for IE.
Kyle Sevenoaks
It's not working in Chrome for me - you're missing `counter-reset: number;` on the list.
DisgruntledGoat
Edited to add `counter-reset: number;`.
Kyle Sevenoaks
A: 

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
A: 

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