Scroll down
to see
the magic

More info on GitHub

Progress bar without JavaScript

Scroll Progress Bar - CSS only (with scroll-driven animations)

This demo shows how to build a scroll progress bar entirely in CSS, using scroll-driven animations animation-timeline: scroll(), custom properties, and no JavaScript for the progress itself.

The progress bar at the top of the page is driven by a CSS custom property --scroll that animates from 0 to 100 as the document scrolls.

This value is then reused to dynamically update the bar’s gradient; all handled by the browser’s animation engine.

What’s CSS-only here

About the percentage counter

Displaying a live numeric value in pure CSS has long been considered difficult, especially when the value is driven by animations.

This demo uses a modern CSS approach combining typed custom properties @property and CSS counters to display the scroll percentage without JavaScript.

This technique relies on very recent CSS features and is currently supported only in modern Chromium-based browsers and Safari.

In production environments, JavaScript is still the most robust solution for dynamic numeric text — but this demo shows what modern CSS can already do.

Takeaway

This pen explores the current frontier of what CSS can do today, without polyfills, hacks, or misleading shortcuts.