The counter-increment property increases a CSS counter — useful for automatic section numbers, custom lists, and step indicators.
01
Increment
Increase counter.
02
CSS Counters
Named variables.
03
Default none
No increment.
04
With content
Display numbers.
05
counter-reset
Set start value.
06
Custom Lists
Beyond ol/ul.
Fundamentals
Definition and Usage
The counter-increment CSS property increases the value of a CSS counter. Counters are variables maintained by CSS whose values can be incremented or decremented by CSS rules. They are useful for creating complex lists, numbering headings, and other content that requires incremental numbering.
Typically you combine three pieces: counter-reset to initialize, counter-increment on elements that should advance the count, and content: counter(name) in a pseudo-element to show the number.
💡
Beginner Tip
Increment happens when the element is rendered. Put counter-increment on the same element (or its ::before) where you display the counter value for predictable numbering.
Foundation
📝 Syntax
The syntax lets you specify the counter name and how much to increment:
Each h2 increments chapter and resets section. Each h3 increments section and displays chapter.section with two counter() values.
🧠 How counter-increment Works
1
counter-reset initializes
A parent sets the starting value with counter-reset: section;.
Prerequisite
2
counter-increment runs
Each matching element increases the counter by 1 (or your custom step).
CSS rule
3
counter() displays value
Use content: counter(section) in a pseudo-element to show the number.
Display
=
🔢
Automatic numbering
Headings and list items get dynamic numbers without manual HTML editing.
Compatibility
Modern Browser Support
The counter-increment property is widely supported across all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera.
✓ Baseline · Modern browsers
CSS counters everywhere
All major browsers support counter-increment as part of the CSS Counter Styles module.
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-increment property99% supported
Bottom line: Use CSS counters reliably in modern browsers. Test nested counter layouts in Safari if your design depends on them.
Wrap Up
Conclusion
The counter-increment property is a powerful feature in CSS that allows for sophisticated control over content numbering and ordering. By using it in combination with counter-reset and the content property, you can create dynamic and automatically numbered elements in your web pages.
Experiment with different counters and increment values to see how they can enhance your designs and user interfaces.
Always counter-reset before incrementing for predictable starts
Display counters with content: counter(name)
Use meaningful counter names like section or chapter
Reset nested counters on parent headings for outline numbering
Prefer semantic HTML (<ol>) when accessibility is critical
❌ Don’t
Rely on CSS counters alone for essential document structure
Forget to increment before displaying — order matters
Use counters for content screen readers must announce as list items
Mix up counter names across unrelated components
Expect counters to work without content or counter()
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about counter-increment
Use these points when building automatic numbering.
5
Core concepts
🔢01
Increment
Increase counter.
Purpose
⚙02
Default none
No increment.
Default
🖌03
Step of 1
Default amount.
Syntax
📝04
With reset
counter-reset first.
Tip
🛸05
With content
counter() display.
Related
❓ Frequently Asked Questions
counter-increment increases the value of a named CSS counter by a specified amount. Counters are variables maintained by CSS for automatic numbering.
The initial value is none, which means no counter is incremented.
Use counter-reset to set a starting value, counter-increment to increase the counter on each matching element, and content: counter(name) in ::before or ::after to display the number.
If you omit the increment amount and write counter-increment: section, the counter increases by 1 each time.
Yes. If the named counter does not exist yet, it will be created when you first increment it. Still, counter-reset is recommended for predictable starting values.