css 使用CSS计数器编号的自动标题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 使用CSS计数器编号的自动标题相关的知识,希望对你有一定的参考价值。

/*From here http://philarcher.org/diary/2013/headingnumbers/*/

body {counter-reset: h2} /*you may set any container instead of body that will limit the action, like article*/
h2 {counter-reset: h3}
h3 {counter-reset: h4}
h4 {counter-reset: h5}
h5 {counter-reset: h6}
h2:before {counter-increment: h2; content: counter(h2) ". "}
h3:before {counter-increment: h3; content: counter(h2) "." counter(h3) ". "}
h4:before {counter-increment: h4; content: counter(h2) "." counter(h3) "." counter(h4) ". "}
h5:before {counter-increment: h5; content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". "}
h6:before {counter-increment: h6; content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) ". "}
h2.nocount:before, h3.nocount:before, h4.nocount:before, h5.nocount:before, h6.nocount:before {content: ""; counter-increment: none}

以上是关于css 使用CSS计数器编号的自动标题的主要内容,如果未能解决你的问题,请参考以下文章

css 使用CSS计数器自动编号Aras Tech Doc页面

css 使用CSS计数器自动编号Aras Tech Doc部分

xml 使用CSS计数器自动为Aras Tech Doc部分中的特定子元素编号

使用 Cucumber / Selenium 测试 CSS 计数器

CSS Counter 在 Chrome 中使用 slidetoggle 给出错误的编号

#yyds干货盘点#还在用JS计数吗?来试试纯CSS计数器!!!