counter-reset: section;Using CSS counters / notebook
Using CSS counters
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
counter-reset: section page 3 topic;h3 {
counter-increment: section;
}.done {
counter-set: section 20;
}body {
counter-reset: section;
}
h3 {
counter-increment: section;
}
h3::before {
content: "Section " counter(section) ": ";
}counter-reset: reversed(section);<section>
counter-reset: primary 3
<div>A</div>
<div>B</div>
<div>C</div>
<div class="same-primary-name">D</div>
<span> counter-reset: primary 6</span>
<div>E</div>
<div class="new-secondary-name">F</div>
<span> counter-reset: secondary 5</span>
<div>G</div>
<div>H</div>
<div class="same-secondary-name">I </div>
<span> counter-reset: secondary 10</span>
<div>J </div>
<div>K</div>
<section></section>
</section>