# Scroll Progress Bar

> A reading progress bar pinned to the top of the page that fills as you scroll, driven by animation-timeline: scroll().

- Category: [CSS Effects](https://copy-css.com/category/effects)
- Tags: scroll-driven, reading progress, animation-timeline, scroll, indicator, blog
- Live preview: https://copy-css.com/snippets/scroll-progress-bar
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

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

## CSS

```css
.scroll-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 100;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #ec4899);
  transform-origin: 0 50%;
  animation: scroll-progress-grow linear both;
  animation-timeline: scroll();
}

@keyframes scroll-progress-grow {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

@supports not (animation-timeline: scroll()) {
  .scroll-progress {
    display: none;
  }
}
```

## Notes

- This CSS Scroll Progress Bar is 28 lines of pure CSS (0.5 KB) with no JavaScript and no dependencies. It uses scroll-driven animations, keyframe animations, transforms and linear gradients.
- scroll-driven animations: Chrome and Edge 115+ and Safari 26+. Firefox support is very recent; browsers without it skip the animation and show the content as is.
- It animates; wrap the animation in `@media (prefers-reduced-motion: no-preference)` or disable it under `reduce`.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
