Skip to content

Scroll Counter Bar

A copy-paste scroll-driven component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Scroll-DrivenHTMLCSSany framework

Section 01

Section 02

Section 03

Section 04

Section 05

Copy into your project

HTML
<!-- A side rail whose fill + knob track scroll progress -->
<div class="nuda-scrollcb__rail" role="progressbar"
     aria-label="Scroll position">
  <div class="nuda-scrollcb__fill"></div>
  <div class="nuda-scrollcb__knob"></div>
</div>
CSS
/* Scroll Counter Bar
   A vertical rail with a fill (scaleY) and a knob (translateY) that
   both track scroll progress via scroll() timelines. transform only. */

.nuda-scrollcb__rail { position: relative; overflow: hidden; }

.nuda-scrollcb__fill {
  position: absolute;
  inset: 0;
  background: #e4ff54;
  transform-origin: 50% 0;
  transform: scaleY(0);
  animation: nuda-scrollcb-fill linear;
  animation-timeline: scroll(nearest block);
}

.nuda-scrollcb__knob {
  animation: nuda-scrollcb-knob linear;
  animation-timeline: scroll(nearest block);
}

@keyframes nuda-scrollcb-fill { to { transform: scaleY(1); } }
@keyframes nuda-scrollcb-knob { to { transform: translateY(100%); } }

@supports not (animation-timeline: scroll()) {
  .nuda-scrollcb__fill { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .nuda-scrollcb__fill,
  .nuda-scrollcb__knob {
    animation: none;
    animation-timeline: none;
  }
  .nuda-scrollcb__fill { transform: scaleY(1); }
}

How to use Scroll Counter Bar

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More scroll-driven components

← Browse all NudaUI components