Skip to main content
CSS-Tricks
  • Articles
  • Notes
  • Links
  • Guides
  • Almanac
  • Picks
  • Shuffle
Search

Articles Tagged
counter-increment

3 Articles
{
,

}
Direct link to the article Displaying the Current Step with CSS Counters
counter-increment counters

Displaying the Current Step with CSS Counters

Say you have five buttons. Each button is a step. If you click on the fourth button, you’re on step 4 of 5, and you want to display that.

This kind of counting and displaying could be hard-coded, but that’s …

Jan Enning on Jul 17, 2020
Direct link to the article How to Reverse CSS Custom Counters
counter-increment counters lists

How to Reverse CSS Custom Counters

I needed a numbered list of blog posts to be listed with the last/high first and going down from there. Like this:

5. Post Title
4. Post Title
3. Post Title
2. Post Title
1. Post Title

But the above …

Etinosa Obaseki on Jun 11, 2020
Direct link to the article counter-increment
counter-increment counters lists

counter-increment

Ordered lists aren’t the only elements that can be automatically numbered. Thanks to the various counter-related properties, any element can be.

<body<section</section<section</section<section</section<section</section</body
body {
  counter-reset: my-awesome-counter;
}
section {
  counter-increment: my-awesome-counter;
…
Sara Cope on Apr 19, 2025

CSS-Tricks is powered by DigitalOcean.

Keep up to date on web dev

with our hand-crafted newsletter

DigitalOcean
  • About DO
  • Cloudways
  • Legal stuff
  • Get free credit!
CSS-Tricks
  • Contact
  • Write for CSS-Tricks!
  • Advertise with us
Social
  • RSS Feeds
  • CodePen
  • Mastodon
  • Bluesky
Back to Top