counter-increment是一个函数,属性设置某个选取器每次出现的计数器增量。默认增量是 1。
counter-increment是一个函数,属性设置某个选取器每次出现的计数器增量。默认增量是 1。
属性设置某个选取器每次出现的计数器增量。默认增量是 1。
如果使用了 "display: none",则无法增加计数。如使用 "visibility: hidden",则可增加计数。
继承性:NO
利用这个属性,计数器可以递增(或递减)某个值,这可以是正值或负值。如果没有提供 number 值,则默认为 1。
CSS 属性也可通过一段 Javascript 被动态地改变。
object.style.counterIncrement="section 2"
A way to number sections with "Section 1", "Section 2", "Section 3"etc.: h1:before {content: "Section " counter(section) " ";counter-increment: section; }A way to number sections with "Section 1", "Section 3", "Section 5" etc.:h1:before {content: "Section " counter(section) " ";counter-increment: section 2; }
counter-increment:none | +
默认值:none
none:
阻止计数器增加
<identifier>:
identifier定义一个或多个将被增加的selector,id,或者class
<integer>:
定义计算器每次增加的数值,可以为负值,默认值是1
设定当一个selector发生时计数器增加的值。
对应的脚本特性为counterIncrement。
默认时的计数器:列表项列表项列表项修改计数器每次增加的值为2:列表项列表项列表项修改计数器每次增加的值为 - 1:列表项列表项列表项