The counter-set property sets one or more named CSS counters to absolute integer values on that element. A bare name sets the counter to 0. Use it to jump or restart numbering mid-document after counter-reset and counter-increment.
Print the value with content and counter(). The initial value is none. It is not inherited. Prefer counter-reset to create a counter; use counter-set to change its value later.
Baseline · Widely available.
Not deprecated and not experimental. Cross-browser since Safari 17.2 (December 2023). Not supported in Internet Explorer.
Order tip.
On the same element, counter-set runs before counter-increment. So counter-set: section 9 plus a normal +1 prints 10.
Second item jumps.counter-set: section 4 then +1 prints 5.
Third item continues. Another +1 prints 6.
Use case. Pick a known number mid-document without wrapping a new reset parent.
Edge Cases & Pitfalls
Most surprises come from set-then-increment order or mixing set with reset.
order
Set runs before increment
If both apply on one element, the counter is assigned first, then increased. Plan the integer one step below the number you want to print.
create
Prefer reset to create counters
counter-set can create a missing counter, but counter-reset is the clearer create step.
scope
Set is not a nested reset
A nested counter-reset starts a new scope. counter-set changes the current counter value in place.
display
Nothing shows without content
You still need content and counter() on a pseudo-element to print the number.
support
Newer than classic counters
counter-reset and counter-increment work in old browsers. counter-set needs modern ones (no IE; Safari 17.2+).
Compatibility
Browser Support
counter-set is a browser CSS property for assigning counter values. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
counter-set
Supported in modern browsers since Safari 17.2 (December 2023). Not available in Internet Explorer.
96%Modern support
Google Chrome85+
Full support
Mozilla Firefox68+
Full support
Apple Safari17.2+
Full support
Microsoft Edge85+
Full support
Opera71+
Full support
Samsung Internet14+
Full support
Internet Explorer—
No support
counter-setModern browsers
Bottom line: Safe for modern sites when you need mid-document numbering jumps. For IE-era support, stick to counter-reset and counter-increment. It is not a runtime API.
Remember
Key Takeaways
Role: assign absolute values to named CSS counters on an element.
Default: a bare name sets the counter to 0. Initial property value is none.
Order: set before increment on the same element — plan the integer one step low.
Create vs jump: use counter-reset to create; use counter-set to jump.
One line:counter-set jumps the counter to a value — then increment and content show the new sequence.
Frequently Asked Questions
It sets one or more named CSS counters to absolute integer values on that element. If you omit the integer, the counter is set to 0.
The initial value is none, which means no counter values are changed on that element.
counter-reset creates and initializes a counter (usually on a parent). counter-set jumps an existing counter to a value at a specific element. Prefer reset to create; use set to jump mid-document.
On the same element, counter-set runs before counter-increment. The counter becomes 9, then increment adds 1, so the printed value is 10.
Yes, it can create one if needed, but MDN recommends counter-reset when you want to create a counter on purpose.
It is Baseline and widely available in modern browsers (Chrome 85+, Firefox 68+, Safari 17.2+, Edge 85+). It is not supported in Internet Explorer. It is a browser CSS property, not a Node.js feature.