How to setup counters for target-counters

血红的双手。 提交于 2019-12-05 08:35:57

From the Generated Content Module (for non-paged content, too):

Counters are "self-nesting", in the sense that re-using a counter in a child element automatically creates a new instance of the counter.

Therefore, you can just write

<style type="text/css">    
section {counter-increment: section;}
</style>

<section id="foo">
<h1>Root level</h1>
    <section id="bar">
    <h2>Sub Level</h2>
    </section>
</section>

There is no way to use nested counters if your element tree is flat (as in <h1>Root</h1><h2>Sub</h2>).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!