Monograph 01 / 19CSS reading progress bar

Build a CSS Reading Progress Bar That Stays in Sync

Build a reading progress bar with CSS scroll-driven animations. Learn which scroll container to track and how to handle short pages, older browsers, and reduced motion.

Radiaix Engineering & Product EditorialCustom Software, AI Agents, Web Platforms & QA Architecture
Published 5 min read
A mint progress bar and the scrollbar thumb both sit halfway along their tracks in an illustrated browser window.
Section 01

Tie the bar to the page the reader scrolls

Open a long release guide from a link to its troubleshooting section. The page lands halfway down, but the progress bar stays empty until you scroll. That small mismatch tells you something about the implementation. The bar is waiting for an event, even though the browser already knows where the reader is.

A CSS reading progress bar can use that position directly. Firefox 159 enabled scroll-driven animations by default in October 2026, bringing the feature to Baseline Newly available. Current releases of the core browsers support it, and older releases can still show the article with the bar omitted. Firefox 159 release notes · October web platform update

Section 02

Decide where the bar should reach the end

A scroll progress timeline maps the start and end of a scroll container to 0% and 100%. On a typical page, divide the scroll offset by the scrollable distance, which is the content height minus the visible height. A document with 2,400 pixels of content in an 800-pixel viewport has 1,600 pixels of travel. An offset of 800 pixels puts the bar halfway across. The timeline is inactive if the content fits without scrolling. CSS Working Group specification

Use scroll(root block) for a page-wide indicator. The root is the page viewport, and the block axis runs vertically in ordinary horizontal writing modes. If your help center renders an article in its own scrolling pane, put the indicator inside that pane and use scroll(nearest block), provided the pane is its nearest scrolling ancestor. A named scroll timeline can target the pane when the layout puts the indicator elsewhere. Chrome’s guide to scroll timelines

Look at what sits below the last paragraph. A root timeline includes the footer and recommendations, so the bar fills at the bottom of the page. If the label promises article progress and a long footer follows the article, use an article scroller where the reading layout already has one, or describe the indicator as page progress.

Section 03

Scale a thin bar with a CSS animation

Add an empty element with a reading-progress class and aria-hidden="true". For a standard left-to-right article page, place the bar at the top of the viewport, or just below the site header, and make it span the viewport. Keep it decorative. Readers can still use headings and the table of contents to find their place. Chrome’s progress indicator implementation

  • Start with display: none and transform: scaleX(0). A browser without support will omit the bar, and a supported browser will start with a zero-width transform when there is no active scroll timeline.
  • Inside @supports (animation-timeline: scroll(root block)) and @media (prefers-reduced-motion: no-preference), give the element display: block, position: fixed, top: 0, inset-inline: 0, height: 3px, pointer-events: none, and a visible background color. Use transform-origin: left center so the fill grows from the left. For a right-to-left version, move the origin to the right edge.
  • Define a reading-fill keyframe animation that goes from transform: scaleX(0) to transform: scaleX(1). Set animation: reading-fill 1ms linear both and then animation-timeline: scroll(root block). The linear timing makes halfway through the scroll range correspond to half the bar. Declare the timeline after the animation shorthand because the shorthand resets it. Timeline declaration and duration details
Section 04

Test what happens when the document grows

The bar reflects scroll position against the current scroll range. If a late-loading image increases that range, the fraction can go down even while the reader stays at roughly the same spot. Reserve image space with width and height attributes so the browser can size the image before loading it. Test expanding an accordion and loading related content too, especially when either change happens below the fold. web.dev guide to layout stability

Keep the bar’s box full width and animate its transform. The fill then changes without resizing that box during scrolling. Use a thin strip that stays clear of focused controls, and use the system reduced-motion preference to omit it. A short page can also omit the visible fill because the base transform stays at zero when there is no scroll range. W3C technique for honoring reduced motion

Section 05

Verify keyboard, deep links, and the mobile layout

Test the same article in your supported desktop and mobile browsers. Use a long fixture with a known scroll range and a short fixture that fits in one viewport. Add both to the checks your team runs before release.

  • Check the top, midpoint, and end. The fill should be empty, half width, and full width at those positions. Scroll back up and confirm the bar shrinks.
  • Open a heading link in a fresh tab. The fill should reflect where the browser lands. Then use Page Down and End, or the equivalent keyboard shortcuts for your platform, to verify that keyboard input moves the same bar.
  • Scroll a nested panel independently. A page-level bar should only follow the page. If the panel is the intended scroller, verify that the bar moves when the panel moves and reaches full width at the panel’s end.
  • Enable reduced motion and open the short fixture. Check these separately. Reduced motion should hide the bar even on a long page. A page with no scroll range should show no fill even when motion is enabled.
Section 06

Try it on one long article first

Start on the longest guide your readers actually use. Open it directly at a heading, change the viewport size, and reach the bottom by keyboard. Check those same paths with reduced motion enabled. Once the bar follows the intended scroller through those cases, you can reuse the pattern on the rest of the article template.

Executive Summary

Key Engineering Takeaways

TAKEAWAY // 01Use a root timeline for page progress and a timeline tied to the article pane for an independently scrolling article.
TAKEAWAY // 02Animate scaleX and declare animation-timeline after the animation shorthand.
TAKEAWAY // 03Test deep links, changing content, short pages, and reduced motion before reusing the pattern.
Common Questions

Frequently Asked Questions

Does a CSS reading progress bar need a JavaScript scroll listener?

CSS can drive the decorative bar from a scroll timeline in supporting browsers. Older browsers can omit it and display the same article and navigation.

Why does the bar stay empty when I scroll?

Check whether the timeline is attached to the element you are scrolling, whether that element has overflow along the specified axis, and whether a later animation shorthand reset the timeline.

Why does the bar fill after the last paragraph?

A root timeline tracks the full document, including any footer or recommendations. Use the article pane’s scroll timeline when the article has its own scrolling container.

Continue Exploring Radiaix Monographs
All 19 Articles
MONOGRAPH // 01Web Development
Printwell Custom Apparel interactive e-commerce configurator engineered by Radiaix
Custom E-Commerce & Product Configurator Development8 min read

Engineering High-Conversion E-Commerce & Custom Product Configurators

Standard store templates break when products require custom sizing, bulk pricing tiers, or interactive visual previews. See how Radiaix builds high-converting commerce engines.

Radiaix Proof: Radiaix engineered bespoke product customization flows, high-speed visual catalogs, and streamlined mobile checkouts tailored to each brand's fulfillment rules.
MONOGRAPH // 02Web Development
High-performance Next.js web platforms and e-commerce interfaces engineered by Radiaix
Next.js Web Platform Modernization8 min read

When a Web Platform Needs More Than a Redesign: Next.js & Core Web Vitals Architecture

A fresh coat of CSS cannot fix slow Core Web Vitals, brittle content schemas, or poor technical SEO. Learn how Radiaix re-architects modern Next.js web platforms for speed and conversion.

Radiaix Proof: Radiaix re-architected their digital presence on modern Next.js foundations with interactive calculators, bespoke e-commerce flows, semantic SEO schemas, and sub-second page loads.
Next Monograph · AI & Automation

How to Migrate Workflows Off Vertex AI Extensions

Turn Architecture Into Production

Ready to solve this bottleneck with Radiaix?

Partner with Radiaix to scope, build, and launch your next system.