The counter-reset property creates or resets CSS counters — the starting point before counter-increment and content: counter().
01
Initialize
Create counters.
02
Reset
Start over.
03
Default none
No counter set.
04
Start Value
Optional number.
05
With increment
Full counter flow.
06
Nested
Scoped numbering.
Fundamentals
Definition and Usage
The counter-reset CSS property creates or resets one or more CSS counters. Counters track the occurrence of elements and are often used for numbering items in a list, creating custom section counters, or managing complex numbering schemes in documents.
Place counter-reset on a container (such as body, an article, or a list) before using counter-increment on child elements and displaying values with content: counter(name).
💡
Beginner Tip
counter-reset: section; sets the counter to 0. After the first counter-increment: section;, the displayed value is 1. Use a custom start like counter-reset: section 4; to begin at 5 after increment.
Foundation
📝 Syntax
The syntax lets you specify one or more counters and their initial values:
counter-reset: chapter section; initializes both counters; each h2 increments chapter and resets section for sub-numbering.
🧠 How counter-reset Works
1
You set counter-reset
Initialize a named counter on a container: counter-reset: section;.
CSS rule
2
counter-increment advances
Child elements increase the counter when encountered.
Increment
3
counter() displays value
Show the number in a pseudo-element with content: counter(section).
Display
=
🔢
Controlled numbering
Counters start at a predictable value and produce automatic numbers.
Compatibility
Modern Browser Support
The counter-reset property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera.
✓ Baseline · Modern browsers
Counter reset everywhere
All major browsers support counter-reset as a well-established CSS feature.
99%Modern browser support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions
Full support
OperaAll modern versions
Full support
counter-reset property99% supported
Bottom line: Use counter-reset confidently in modern projects. Pair it with increment and content for full counter workflows.
Wrap Up
Conclusion
The counter-reset property is a versatile tool for managing counters in your web documents. Whether you’re creating numbered lists, custom section counters, or complex numbering schemes, this property provides a straightforward way to initialize and manage counters.
Experiment with different counter names and values to see how they can enhance the structure and readability of your content.
Reset counters on the container before incrementing children
Use scoped resets on articles or sections for independent numbering
Choose descriptive counter names like chapter or step
Set custom start values when numbering should not begin at 1
Combine with counter-increment and content: counter()
❌ Don’t
Forget to reset — counters may inherit unexpected values
Rely on CSS counters for critical accessibility structure
Reset and increment on the same element without understanding order
Use confusing counter names across unrelated components
Expect visible numbers without content: counter()
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about counter-reset
Use these points when initializing CSS counters.
5
Core concepts
🔢01
Initialize
Create counters.
Purpose
⚙02
Default none
No reset.
Default
🖌03
Start at 0
If no number.
Syntax
📝04
First step
Before increment.
Tip
🛸05
Scoped
Per container.
Pattern
❓ Frequently Asked Questions
counter-reset creates or resets one or more CSS counters to a specified initial value. It is the first step in building automatic numbering with CSS counters.
The initial value is none, which means no counter is created or reset.
counter-reset initializes or resets a counter to a starting value. counter-increment increases the counter each time a matching element is encountered.
If you write counter-reset: section without a number, the counter starts at 0. The first counter-increment typically displays 1.
Yes. You can list several counters: counter-reset: chapter section; or set custom starts: counter-reset: item 0 chapter 1;