开发者

How to remove period (.) from OL numbering?

开发者 https://www.devze.com 2022-12-28 18:45 出处:网络
http://jsbin.com/urice I want to remove .after number. 1. should be 1 only With All browser compatibility in开发者_高级运维ducing IE6 and validity.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号