利用该三个属性可以构建列表前面的标签
在分为h1为标题1,h2为标题2
content 可以利用before为标签为标题前面添加内容
counter-increment 可以使得h1和h2标题每用一次就实现一次增加
counter-reset可以使得h1标签每次调用的时候讲子标题序号重置
<style>
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) " ";
}
</style>
另外还可以实现计数器:
http://caibaojian.com/css-counter.html
不仅仅可以用于标题,还可以用于checkbox:
input:checked { counter-increment: icecream; }
实现计数功能。