Skip to content

Timeline with Scroll Progress Line

Dark vertical timeline whose glowing center line fills as you scroll, lighting up each milestone when it is reached. Alternating cards on desktop.

Also known as: scroll progress timeline, vertical timeline on scroll, animated timeline, scroll triggered timeline, milestone timeline

Timeline with Scroll Progress Line live demo

Open in new tab

Pure CSS code (HTML, CSS, JS)

A dark vertical timeline in plain CSS and a small vanilla JavaScript file. A cyan-to-violet line fills from top to bottom as the visitor scrolls, and every milestone lights up the moment the line reaches its dot. Use it for company history, product roadmaps, release notes or project phases.

How it works

The root section.spt-timeline contains a header and a .spt-track. Inside the track, .spt-line is the gray rail and .spt-line-fill is the gradient bar on top of it. The fill is drawn with transform: scaleY(var(--spt-progress)) and transform-origin: top, so a single custom property between 0 and 1 controls how much of the line is colored. The milestones are an ordered list ol.spt-list; every li.spt-item has a .spt-dot and a .spt-card with a time.spt-date, a .spt-title and a .spt-text.

On phones the rail sits on the left and all cards stack to its right. From 768px the --spt-axis variable moves the rail to the center, odd items align right on the left side, even items move to the right, and a thin connector is drawn with .spt-card::after.

script.js adds .is-ready to each timeline and listens for scroll (passive), resize and load, batching work with requestAnimationFrame. It measures where the track crosses a trigger line in the viewport, writes the result to --spt-progress, and toggles .is-reached on every item whose dot is above that line. Items that are not reached yet are dimmed and shifted down slightly. At the very bottom of the page the trigger moves to the viewport edge, so the last milestone always lights up. Without JavaScript the line is full and every milestone is shown as reached.

Customization

  • data-spt-offset on .spt-timeline: where the trigger line sits, as a fraction of the viewport height; 0.5 reacts at the middle of the screen, 0.8 reacts earlier.
  • --spt-from and --spt-to: the two colors of the fill gradient, the reached dots and the dates.
  • --spt-rail: the color of the empty rail and of dots that are not reached yet.
  • --spt-line-width and --spt-dot-size: the thickness of the line and the diameter of the dots.
  • --spt-bg and --spt-surface: the page background and the card background.
  • The 768px media query: change the breakpoint where the layout switches from one column to alternating cards.
  • Add or remove li.spt-item elements freely; the script measures them on every update.

Use cases

  • Company history pages: milestones light up one by one as visitors scroll down the glowing line
  • Product roadmaps: alternating cards show planned phases with dates in a clear vertical order
  • Release notes and changelogs: each version is a dated card on a timeline that fills as you read
  • Project case studies: phases of a project are told step by step along a line that follows the scroll
  • About pages: a dark cyan-to-violet timeline gives a founding story a polished look on desktop and phones

Accessibility

The milestones are a real ordered list with time elements and datetime values, so assistive technology reads them in order with machine-readable dates. The line and dots are decorative and marked aria-hidden. Dimmed cards keep readable contrast, and no content is hidden. Fade transitions only start after the first user scroll, and with prefers-reduced-motion: reduce they are removed completely, while the line still follows the scroll position.

Usage notes

Several timelines can share a page; each one is measured on its own.

Timeline with Scroll Progress Line at a glance

Framework
Pure CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
None
Layout
Responsive, works on mobile, dark design
Category
Timelines
License
Free for personal and commercial use

Questions about this template

Can I use the Timeline with Scroll Progress Line code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

There is nothing to install. Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

No dependencies. Pure HTML, CSS and JavaScript.

Timeline with Scroll Progress Line – Pure CSS timelines component screenshot
Timeline with Scroll Progress Line · Pure CSS Timelines

More Timelines

Alternating Timeline – Pure CSS timelines preview

Alternating Timeline

Pure CSS vertical timeline with a center line and entries that alternate left and right, collapsing to a single column on mobile.

Activity Feed Timeline – Bootstrap 5 timelines preview

Activity Feed Timeline

Dark Bootstrap 5 activity feed timeline with colored event icons, timestamps, quoted comments and filter chips for code, comments and deploys.

Vertical Timeline – Tailwind CSS timelines preview

Vertical Timeline

Responsive Tailwind CSS vertical timeline with icon markers, dates, category labels and descriptions that alternate left and right on wider screens.