CKTIS / CSS
counter-reset — creating CSS counters
counter-reset creates named counters with initial values; it does not itself increment or display them.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
counter-reset: none | [ <counter-name> <integer>? | reversed(<counter-name>) <integer>? ]+;counter-reset creates a new counter rather than updating an existing one like counter-set. A same-named counter created on a descendant nests inside its ancestor’s counter.
An ordinary counter starts at 0 unless given an integer, including a negative one. Separate multiple pairs without commas. The initial none creates no counters; it does not delete existing ones. The property is not inherited.
reversed(name) without a number calculates its start automatically. For custom countdowns, specify counter-increment: name -1; check reversed() support separately.
counter-increment changes the value; counter() displays it. The example’s start of 3 produces the first label 4.
Examples
<!doctype html>
<meta charset="utf-8">
<title>counter-reset</title>
<style>
section { counter-reset: step 3; }
p { counter-increment: step; }
p::before { content: counter(step) ". "; }
</style>
<section>
<p>Alpha</p>
<p>Beta</p>
</section>Result
4. Alpha 5. Beta
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.