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
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.
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
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
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.
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.
Key Engineering Takeaways
Related Radiaix Systems, Services & Technical References
The update documents when scroll-driven animations reached Baseline Newly available.
The CSS Working Group draft defines scroll progress, inactive timelines, and the scroll() function.
Chrome’s implementation guide includes a runnable demo and covers feature detection, transform animation, and decorative indicators.
MDN explains timeline selection, animation shorthand ordering, and the nonzero-duration compatibility pattern.
W3C shows how to use prefers-reduced-motion to control optional motion.
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.



