counter-increment 百科内容来自于: 百度百科

定义

属性设置某个选取器每次出现的计数器增量。默认增量是 1。
如果使用了 "display: none",则无法增加计数。如使用 "visibility: hidden",则可增加计数。
继承性:NO
利用这个属性,计数器可以递增(或递减)某个值,这可以是正值或负值。如果没有提供 number 值,则默认为 1。

JavaScript 语法

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) " ";/* Add 1 to section */counter-increment: section; }A way to number sections with "Section 1", "Section 3", "Section 5" etc.:h1:before {content: "Section " counter(section) " ";/* Add 2 to section */counter-increment: section 2; }

counter-increment属性

语法

counter-increment:none | []+
默认值:none

取值

none:
阻止计数器增加
<identifier>:
identifier定义一个或多个将被增加的selector,id,或者class
<integer>:
定义计算器每次增加的数值,可以为负值,默认值是1

说明

设定当一个selector发生时计数器增加的值。
对应的脚本特性为 counterIncrement。

示例

默认时的计数器:列表项列表项列表项修改计数器每次增加的值为2:列表项列表项列表项修改计数器每次增加的值为 - 1:列表项列表项列表项
$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定