http://jsbin.com/urice
I want to remove .
after number.
1.
should be 1
only
With All browser compatibility in开发者_高级运维ducing 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.
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.
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.
Using jQuery to find the < li > and inserting an incrementing number into their .innerHTML is probably the best way to do this using javascript.
精彩评论