counter-increment in CSS

后端 未结 2 1904
有刺的猬
有刺的猬 2020-12-21 12:25

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 achie

相关标签:
2条回答
  • 2020-12-21 12:36

    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/

    0 讨论(0)
  • 2020-12-21 12:58

    Try to add this rule:

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

    This will remove the zero at the first element.

    0 讨论(0)
提交回复
热议问题