CSS counter-increment 属性
实例
对部分和子部分进行编号(比如 "Section 1"、"1.1"、"1.2")的方法:
body
{
counter-reset:section;
}
h1
{
counter-reset:subsection;
}
h1:before
{
counter-increment:section;
content:"Section " counter(section) ". ";
}
h2:before
{
counter-increment:subsection;
content:counter(section) "." counter(subsection) " ";
}
属性定义及使用说明
counter-increment属性递增一个或多个计数器值。
counter-increment属性通常用于counter-reset属性和content属性。
默认值: | none |
---|---|
继承: | no |
版本: | CSS2 |
JavaScript 语法: | object.style.counterIncrement="subsection" |
浏览器支持
所有主流浏览器都支持counter-increment属性。
注意:IE8只有指定!DOCTYPE才支持counter-increment属性。
属性值
值 | 说明 |
---|---|
none | 没有计数器将递增 |
id number | id 定义将增加计数的选择器、id 或 class。number 定义增量。number 可以是正数、零或者负数。 |
inherit | 指定counter-increment属性的值,应该从父元素继承 |
相关推荐
-
PHP8种变量类型的详细讲解2025-02-22 00:32:24
-
php+apache 和 php+nginx的区别2025-02-22 00:21:27
-
PHP:与workerman结合实现定时任务2025-02-22 00:15:57
-
Nginx的Rewrite规则与实例2025-02-22 00:15:39
-
MySql中身份证字段的简单脱敏介绍2025-02-22 00:15:36