Jitendra Vyas
Jitendra Vyas

Reputation: 152687

How to remove period (.) from OL numbering?

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.

Upvotes: 2

Views: 2296

Answers (3)

Kyle
Kyle

Reputation: 67194

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.

Upvotes: 3

DisgruntledGoat
DisgruntledGoat

Reputation: 72540

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.

Upvotes: 1

cazlab
cazlab

Reputation: 788

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

Upvotes: 0

Related Questions