Kheema Pandey
Kheema Pandey

Reputation: 10265

counter-increment in CSS

I am trying to get an ordered list first item shouldn't start with number. The number should start from second item.

please check this URL what I am trying to achieve-- http://jsfiddle.net/kheema/tXtQF/5/

here using counter-reset and counter-increment first item shows 0 and second item starts from 1.. and if anyhow I could remove a 0 my problem will solve.

Does anyone have a better idea on this?

Regards, Kheema

Upvotes: 2

Views: 1127

Answers (2)

Fabrizio Calderan
Fabrizio Calderan

Reputation: 123367

just change last css rule into

ol li:before {content: ""; color: green; display: inline-block; width: ... ; }
ol li + li:before {content: counter(chapter) "."; }

in this way you insert the content starting from second li element (I used li + li so it can work also with IE8)

see fiddle: http://jsfiddle.net/WwNqN/

Upvotes: 3

tbraun89
tbraun89

Reputation: 2234

Try to add this rule:

ol li:nth-of-type(1):before{content: "";}

This will remove the zero at the first element.

Upvotes: 1

Related Questions