CSS参考手册
»
属性列表
»
内容属性
»
相关内容:
其它内容属性参考
选择其它项
content
counter-increment
counter-reset
quotes
counter-reset
版本:CSS2
继承性:无
语法:
counter-reset
:none | [
<identifier>
<integer>
]+
默认值
:
none
取值:
none:
阻止计数器复位
<identifier>
:
identifier定义一个或多个将被复位的selector,id,或者class
<integer>
:
定义被复位的数值,可以为负值,默认值是0
说明:
将指定selector的计数器复位。
对应的脚本特性为
counterReset
。
兼容性:
浅绿
= 支持
红色
= 不支持
墨绿
= 部分支持
橙色
= 实验性质
支持版本
\类型
IE
Firefox
Safari
Chrome
Opera
版本
6.0-7.0
4.0
5.1
13.0
11.50
版本
8.0
示例:
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="utf-8" /> <title>CSS content-reset_CSS参考手册_web前端开发参考手册系列</title> <meta name="author" content="phpstudy.net" /> <meta name="copyright" content="www.phpstudy.net" /> <style> .test ol{margin:16px 0;padding:0;list-style:none;} .test li li:before{color:#f00;font-family:georgia,serif,sans-serif;} .counter1 li{counter-increment:testname;} .counter1 li:before{content:counter(testname)".";counter-reset:testname;} .counter2 li{counter-increment:testname2;} .counter2 li:before{content:counter(testname2)".";counter-reset:testname2 20;} .counter3 li{counter-increment:testname3;} .counter3 li:before{content:counter(testname3)".";counter-reset:testname3 -1;} </style> </head> <body> <ul class="test"> <li class="counter1"> <strong>默认时被复位的计数器:</strong> <ol> <li>列表项</li> <li>列表项</li> <li>列表项</li> </ol> </li> <li class="counter2"> <strong>将计算器复位为20:</strong> <ol> <li>列表项</li> <li>列表项</li> <li>列表项</li> </ol> </li> <li class="counter3"> <strong>将计算器复位为-1:</strong> <ol> <li>列表项</li> <li>列表项</li> <li>列表项</li> </ol> </li> </ul> </body> </html>