Rolling digit counter in WordPress
Digits that spin on their rollers like a mechanical counter before stopping on the right value, in pure CSS.
Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.
This component also comes in
The code in WordPress
<?php
/**
* Plugin Name: Forge, Compteur à rouleaux
* Description: Des chiffres qui défilent sur leurs rouleaux comme un compteur mécanique avant de s’arrêter sur la bonne valeur, en CSS pur. Ajoute la composition « Compteur à rouleaux » à l'éditeur de blocs.
* Version: 1.0.0
* Requires at least: 6.6
* Requires PHP: 8.1
* Author: Forge
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: forge-effet-compteur-rouleaux
*<!-- wp:group {"tagName": "section", "className": "efcr-effet-compteur-rouleaux", "layout": {"type": "default"}} -->
<section class="wp-block-group efcr-effet-compteur-rouleaux"><!-- wp:heading {"level": 2, "className": "efcr-title", "anchor": "efcr-titre"} -->
<h2 class="wp-block-heading efcr-title" id="efcr-titre">Haies Vives du Perche, en chiffres</h2>
<!-- /wp:heading -->
<!-- wp:html -->
<dl class="efcr-list">
<div class="efcr-item">
<dt class="efcr-label">arbres plantés depuis 2019</dt>
<dd class="efcr-value"><span class="efcr-sr">12 480</span><span class="efcr-digits" aria-hidden="true"><span class="efcr-col"><span class="efcr-strip" style="--efcr-effet-compteur-rouleaux-digit: 1; --efcr-effet-compteur-rouleaux-i: 0"><span>0</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span></span></span><span class="efcr-col"><span class="efcr-strip" style="--efcr-effet-compteur-rouleaux-digit: 2; --efcr-effet-compteur-rouleaux-i: 1"><span>0</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span></span></span><span class="efcr-gap"></span><span class="efcr-col"><span class="efcr-strip" style="--efcr-effet-compteur-rouleaux-digit: 4; --efcr-effet-compteur-rouleaux-i: 2"><span>0</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span></span></span><span class="efcr-col"><span class="efcr-strip" style="--efcr-effet-compteur-rouleaux-digit: 8; --efcr-effet-compteur-rouleaux-i: 3"><span>0</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span></span></span><span class="efcr-col"><span class="efcr-strip" style="--efcr-effet-compteur-rouleaux-digit: 0; --efcr-effet-compteur-rouleaux-i: 4"><span>0</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span></span></span></span></dd>
</div>
<div class="efcr-item">
<dt class="efcr-label">kilomètres de haies replantées</dt>:root {
--efcr-effet-compteur-rouleaux-bg: #f3f7ef;
--efcr-effet-compteur-rouleaux-text: #1c2a17;
--efcr-effet-compteur-rouleaux-muted: #4b5b44;
--efcr-effet-compteur-rouleaux-cell: #ffffff;
--efcr-effet-compteur-rouleaux-cell-line: #d5e0cc;
--efcr-effet-compteur-rouleaux-digit: #2f5d1e;
--demo-effet-compteur-rouleaux-bg: #e9efe3;
--demo-effet-compteur-rouleaux-text: #1c2a17;
}
@media (prefers-color-scheme: dark) {Free component: copy it freely, including for commercial projects.
Other visual effects components in WordPress
Visual effects components in WordPress
A large heading whose words turn from grey to ink as the page scrolls, then whose key phrases get a marker stroke, in pure CSS with a readable fallback.
- Tailwind
- React
- CSS
- WordPress

Cards that fade in as they enter the screen, one after another in each row, without a line of JavaScript and with a static fallback.
- Tailwind
- React
- CSS
- WordPress

A translucent card with a saturated blur whose sharper edge refracts the colourful shapes drifting behind it, with an opaque fallback when transparency is reduced.
- Tailwind
- React
- CSS
- WordPress

A help block shaped like a conversation: bubbles, three animated typing dots and clickable quick replies that show your answers to frequent questions, frozen under prefers-reduced-motion.
- Tailwind
- React
- CSS
- WordPress

A paragraph whose words turn from grey to full ink, one by one, as the page scrolls, in pure CSS with a plain-text fallback.
- Tailwind
- React
- CSS
- WordPress

Four offset, translucent sine waves gently roll along the bottom of a section, each at its own pace.
- Tailwind
- React
- CSS
- WordPress