FRENVersion française

In-page navigation

Reading progress indicator

Indicateur de progression de lecture

Demo

Loading demo…

A thin bar, usually at the top of the screen, that fills up as you scroll down an article. It answers "how much is left?" without asking anything of you. Some versions add a percentage or the reading time left.

Story

Did you know

The scrollbar already did this job. But since macOS and mobile devices started hiding it when idle, nothing shows how far along an article you are: the reading bar stepped in to fill the gap.

Timeline

  1. 2011Mac OS X Lion hides scrollbars until you scroll.
  2. 2010sBlogs and news sites add a reading bar at the top of articles, in JS.
  3. 2023Chrome 115 ships scroll-driven animations: the bar becomes doable in pure CSS.
  4. 2025Safari 26 supports them too.

Vocabulary

Names

FR
Indicateur de progression de lecture, barre de lecture, barre de progression de lecture, indicateur de défilement, jauge de lecture
EN
Reading progress indicator, scroll progress bar, reading progress bar, reading position indicator, scroll indicator

Common uses

  • Long blog posts and news articles
  • Tutorials and single-page guides
  • Scroll-driven stories (long-form, scrollytelling)
  • E-readers: percentage of the book read

Often paired with

The components it usually sits with, by page type, in reading order.

Code

<div class="progress" aria-hidden="true"></div>

<style>
  .progress {
    position: fixed; inset: 0 0 auto; z-index: 10; height: 4px;
    background: royalblue; transform-origin: left; transform: scaleX(var(--p, 0));
  }
  @keyframes grow { from { transform: scaleX(0) } to { transform: scaleX(1) } }
  /* Pure CSS where scroll-driven animations are supported */
  @supports (animation-timeline: scroll()) {
    .progress { animation: grow auto linear both; animation-timeline: scroll(root); }
  }
</style>

<script>
  // JS fallback for the other browsers
  if (!CSS.supports('animation-timeline: scroll()')) {
    const bar = document.querySelector('.progress')
    const update = () => {
      const max = document.documentElement.scrollHeight - innerHeight
      bar.style.setProperty('--p', max > 0 ? String(scrollY / max) : '1')
    }
    addEventListener('scroll', update, { passive: true })
    addEventListener('resize', update)
    update()
  }
</script>

Good to know

  • In pure CSS, animation-timeline: scroll(root) ties the animation to scrolling, with no listener and no JS. Chromium has supported it since 2023 and Safari since version 26. Test with @supports and keep a JS fallback.
  • Animate transform: scaleX() rather than width: no layout recalculation on every frame. In JS, batch the measurements in a requestAnimationFrame.
  • Measure the article, not the page. With a big footer or comments, the bar only hits 100% at the very bottom, long after the text ends. Compute (scrollY - article.offsetTop) / (article.offsetHeight - innerHeight) instead, clamped between 0 and 1.
  • A global animation: none !important rule under prefers-reduced-motion also breaks the CSS version. Yet the bar follows your finger, it isn't autonomous motion: exclude it from that rule.

Accessibility

Must have

  • If the bar just mirrors the scrollbar, it is decorative: aria-hidden="true", no role.
  • Avoid role="progressbar" with an aria-valuenow updated on every scroll: some screen readers report every change.
  • If progress really matters, use role="progressbar" (or <progress>) with a name (aria-label="Reading"), and only update the value at milestones: 25, 50, 75, 100%.

Often forgotten

  • No aria-live on a "42% read" text that updates continuously: an announcement on every pixel makes the page unusable with a screen reader.
  • In forced colors mode (forced-colors: active), a bar drawn with background can disappear. Give it a system colour such as Highlight.

Nice to have

  • The reading time left ("4 min") as static text helps everyone, screen reader users included.
  • To really find your way, nothing beats a proper heading hierarchy and a table of contents: that is what screen reader users skim.

Who uses it