Stacking Cards on Scroll
Updated 2026-10-15. 8 effects.
Stacking cards pin each card near the top of the screen with position: sticky, so the next card slides up and covers it, building a deck. A gentle scale-down on the covered cards adds depth. That depth comes from a scroll-driven CSS animation or a few lines of script, while the pinning itself needs none.
The stack suits content that is read in order and has a few large parts: three to six service descriptions, steps in a process, case studies or plans. Each card gets a full moment on screen, and the growing stack quietly shows how far through the list someone is.
Give every card the same height, or at least the same top offset, and give later cards a slightly larger offset if you want the edges of earlier cards to peek out. The snippets expose that offset and the amount each covered card shrinks as variables at the top.
Compare them
| Effect | Built with | Size (gzipped) | Running cost | Browser support |
|---|---|---|---|---|
| Case Study Photo Cards Stacking With Settling Zoom | CSS and a small script | 3.3 KB | Three cards each get two transforms and one opacity per scrolled frame; the photos are composited layers, so no repaint. | All current browsers |
| CSS Only Stacking Cards With Scroll Timeline | CSS only | 2.7 KB | Runs on the browser's scroll timeline with no script at all where supported; the fallback touches one attribute per card. | Chrome, Edge and Safari 26+; script fallback elsewhere |
| Dark Product Feature Cards Stacking on Scroll | CSS and a small script | 3.7 KB | Each scrolled frame sets one transform and two opacities per card; the glow is a pre-drawn shadow layer that only fades. | All current browsers |
| Horizontal Card Deck Stacking Sideways in a Pinned Section | CSS and a small script | 3.3 KB | One rAF-throttled pass per scroll moves five cards with transform and fades five shade layers. | All current browsers |
| Numbered Process Steps Stacking With Peeking Headers | CSS and a small script | 3.1 KB | Only opacity changes, two values per step on each scrolled frame; nothing is scaled or repainted. | All current browsers |
| Stacked Pricing Plan Cards That Pile Up on Scroll | CSS and a small script | 3 KB | A scroll handler throttled to one frame updates three transforms and three opacities, then sleeps. | All current browsers |
| Sticky Stacking Cards That Scale Down and Dim | CSS and a small script | 2.9 KB | One rAF-throttled pass on scroll that writes a transform and an opacity per card; idle when nothing scrolls. | All current browsers |
| Testimonial Cards Stacking With Alternating Tilt | CSS and a small script | 3.1 KB | Per scrolled frame, four cards each get one combined rotate and scale plus one opacity. | All current browsers |
Case Study Photo Cards Stacking With Settling Zoom
A design studio's recent projects arrive as large photo cards that pin and pile up. While a card travels into place its photograph is slightly zoomed and eases back to a natural crop as it lands, then the card shrinks and darkens once the next project covers it. Photo and text sit side by side on desktop and stack on phones.
<section class="w4ccp-root" data-w4ccp tabindex="0" aria-label="Selected projects, scrollable">
<div class="w4ccp-hint" aria-hidden="true"><span>Scroll inside</span></div>
<div class="w4ccp-wrap">
<div class="w4ccp-head">
<div>
<p class="w4ccp-label">Fenwick and Oduya, studio</p>
<h2>Rooms we finished recently</h2>
</div>
<a href="#" class="w4ccp-btn">All projects</a>
</div>
<ul class="w4ccp-list">
<li class="w4ccp-card"><article class="w4ccp-face">
<div class="w4ccp-photo"><img src="https://images.pexels.com/photos/14590691/pexels-photo-14590691.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Restaurant interior with a slatted pine ceiling, round wooden tables and dark metal chairs" loading="eager" width="1200" height="800"></div>
<div class="w4ccp-text">
<p class="w4ccp-kind">Restaurant fit-out</p>
<h3>Cedar Row Kitchen</h3>
<p>A dark former print shop became a dining room of warm timber, with a sunken courtyard and a ceiling of slatted pine to soften the noise of a full Friday.</p>
<dl><div><dt>Place</dt><dd>Lisbon</dd></div><div><dt>Scope</dt><dd>Interior and joinery</dd></div><div><dt>Year</dt><dd>2025</dd></div></dl>
</div>
<span class="w4ccp-shade" aria-hidden="true"></span>
</article></li>
<li class="w4ccp-card"><article class="w4ccp-face">
<div class="w4ccp-photo"><img src="https://images.pexels.com/photos/15122649/pexels-photo-15122649.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="A potter placing a wrapped bowl on tall wooden shelves in a bright ceramics studio" loading="lazy" width="1200" height="800"></div>
<div class="w4ccp-text">
<p class="w4ccp-kind">Workshop</p>
<h3>Kilnhouse Ceramics</h3>
<p>We fitted out a working pottery with deep oak shelving for drying ware, a wash station by the window and storage that keeps finished pieces out of the dust.</p>
<dl><div><dt>Place</dt><dd>Porto</dd></div><div><dt>Scope</dt><dd>Shelving and layout</dd></div><div><dt>Year</dt><dd>2024</dd></div></dl>
</div>
<span class="w4ccp-shade" aria-hidden="true"></span>
</article></li>
<li class="w4ccp-card"><article class="w4ccp-face">
<div class="w4ccp-photo"><img src="https://images.pexels.com/photos/18273285/pexels-photo-18273285.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Modern two-storey house with stone cladding, a black gate and young trees in the front garden" loading="lazy" width="1200" height="800"></div>
<div class="w4ccp-text">
<p class="w4ccp-kind">Private house</p>
<h3>Ashgrove Residence</h3>
<p>A family home of pale stone and dark framing, set behind a low garden of clipped trees so the street side stays quiet and green through the year.</p>
<dl><div><dt>Place</dt><dd>Coimbra</dd></div><div><dt>Scope</dt><dd>Facade and landscape</dd></div><div><dt>Year</dt><dd>2025</dd></div></dl>
</div>
<span class="w4ccp-shade" aria-hidden="true"></span>
</article></li>
</ul>
</div>
</section>
<style>
/* Change these: --w4ccp-sand (background), --w4ccp-accent (labels and focus), --w4ccp-stick (pin line),
and ZOOM in the script for how far each photo eases in as its card lands. */
.w4ccp-root { --w4ccp-sand: #ebe2d3; --w4ccp-accent: #8a3f24; --w4ccp-stick: 28px; height: 660px; overflow-y: auto; position: relative;
background: var(--w4ccp-sand); color: #2d221b; font-family: system-ui, sans-serif; scrollbar-width: thin; scrollbar-color: #c7b79f transparent; }
.w4ccp-root *, .w4ccp-root *::before { box-sizing: border-box; }
.w4ccp-root:focus-visible { outline: 3px solid var(--w4ccp-accent); outline-offset: -3px; }
.w4ccp-hint { position: sticky; top: 0; z-index: 20; height: 0; display: flex; justify-content: center; pointer-events: none; transition: opacity .4s ease; }
.w4ccp-hint span { margin-top: 10px; padding: 4px 12px; border-radius: 999px; background: rgba(45,34,27,.85); color: #faf6ef; font-size: 12px; letter-spacing: .04em; }
.w4ccp-root[data-scrolled] .w4ccp-hint { opacity: 0; }
.w4ccp-wrap { max-width: 64rem; margin: 0 auto; padding: 40px 20px 80px; }
.w4ccp-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.w4ccp-label, .w4ccp-kind { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--w4ccp-accent); }
.w4ccp-head h2 { margin: 8px 0 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(1.875rem, 4vw, 2.25rem); line-height: 1.15; }
.w4ccp-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid #2d221b;
color: #2d221b; font-size: 14px; font-weight: 600; text-decoration: none; }
.w4ccp-btn:hover { background: #2d221b; color: #faf6ef; }
.w4ccp-btn:focus-visible { outline: 2px solid var(--w4ccp-accent); outline-offset: 3px; }
.w4ccp-list { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 24px; }
.w4ccp-card { position: sticky; top: var(--w4ccp-stick); }
.w4ccp-face { position: relative; display: grid; overflow: hidden; border-radius: 24px; background: #faf6ef;
box-shadow: 0 30px 60px -30px rgba(45,34,27,.55); transform-origin: 50% 0; will-change: transform; }
.w4ccp-photo { aspect-ratio: 16 / 10; overflow: hidden; }
.w4ccp-photo img { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.1); will-change: transform; }
.w4ccp-text { display: flex; flex-direction: column; padding: 24px; }
.w4ccp-text h3 { margin: 8px 0 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(1.5rem, 3vw, 1.875rem); }
.w4ccp-text > p:not(.w4ccp-kind) { margin: 12px 0 0; font-size: 15px; line-height: 1.65; color: #5b4a3d; }
.w4ccp-text dl { margin: auto 0 0; padding-top: 20px; border-top: 1px solid #e2d6c3; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; font-size: 14px; }
.w4ccp-text dl { margin-top: 24px; }
.w4ccp-text dt { font-size: 12px; color: #6b5847; }
.w4ccp-text dd { margin: 4px 0 0; font-weight: 500; }
.w4ccp-shade { position: absolute; inset: 0; border-radius: inherit; background: #1d150f; opacity: 0; pointer-events: none; }
@media (min-width: 640px) { .w4ccp-wrap { padding: 40px 32px 80px; } .w4ccp-text { padding: 32px; } }
@media (min-width: 768px) { .w4ccp-face { grid-template-columns: 1.15fr 1fr; } .w4ccp-photo { aspect-ratio: auto; height: 440px; } .w4ccp-text dl { margin-top: auto; } }
@media (prefers-reduced-motion: reduce) { .w4ccp-face, .w4ccp-photo img { transform: none !important; } .w4ccp-shade { opacity: 0 !important; } .w4ccp-hint { display: none; } }
</style>
<script>
(function () {
var root = document.querySelector("[data-w4ccp]");
if (!root || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
var SCALE_STEP = 0.07; // shrink per covering card
var DIM_STEP = 0.3; // darkness per covering card
var ZOOM = 0.1; // extra photo zoom while a card is still arriving
var AUTO = 0; // demo scroll speed in px per second; 0 turns it off
// The box scrolls itself. For page scroll: drop height and overflow on .w4ccp-root and set sc = null.
var sc = root;
var cards = [].slice.call(root.querySelectorAll(".w4ccp-card"));
var raf = 0;
function paint() {
raf = 0;
var top = sc ? sc.getBoundingClientRect().top : 0;
var cover = cards.map(function (c) {
var d = c.getBoundingClientRect().top - top - parseFloat(getComputedStyle(c).top);
return Math.min(1, Math.max(0, 1 - d / c.offsetHeight));
});
cards.forEach(function (c, i) {
var depth = 0;
for (var j = i + 1; j < cards.length; j++) depth += cover[j];
c.firstElementChild.style.transform = "scale(" + (1 - SCALE_STEP * depth) + ")";
c.querySelector(".w4ccp-shade").style.opacity = Math.min(0.6, DIM_STEP * depth);
c.querySelector("img").style.transform = "scale(" + (1 + ZOOM * (1 - cover[i])) + ")";
});
root.toggleAttribute("data-scrolled", (sc ? sc.scrollTop : scrollY) > 8);
}
(sc || window).addEventListener("scroll", function () { if (!raf) raf = requestAnimationFrame(paint); }, { passive: true });
paint();
if (!sc || !AUTO) return;
var demo = 0, last = 0, pos = sc.scrollTop, seen = true, done = false;
function step(now) {
var dt = last ? Math.min(now - last, 50) : 0;
last = now;
pos += AUTO * dt / 1000;
if (pos >= sc.scrollHeight - sc.clientHeight) { done = true; demo = 0; return; }
sc.scrollTop = pos;
demo = requestAnimationFrame(step);
}
function start() { if (!done && seen && !demo) { last = 0; demo = requestAnimationFrame(step); } }
function stop() { cancelAnimationFrame(demo); demo = 0; }
new IntersectionObserver(function (e) { seen = e[0].isIntersecting; seen ? start() : stop(); }).observe(sc);
["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (ev) {
sc.addEventListener(ev, function () { done = true; stop(); }, { passive: true });
});
start();
})();
</script>
With reduced motion: Photos sit at their natural crop and cards pin in order without shrinking, darkening or a demo scroll.
Running cost: Three cards each get two transforms and one opacity per scrolled frame; the photos are composited layers, so no repaint.
- Set `ZOOM` to 0 for still photos, or raise it for a stronger landing.
- Replace photos, places and years in the `projects` array; keep the 16:10 crop so cards never jump.
- Adjust the pile with `SCALE_STEP` and `DIM_STEP`, or move the pin line with `--w4ccp-stick`.
CSS Only Stacking Cards With Scroll Timeline
Gallery room cards that pin and sink into a deck with no script doing the work. Every card shares one scroll timeline, and its index sets the slice of scroll in which it shrinks and darkens beneath the next room. Browsers without scroll-driven animations get a few lines of script that mark covered cards and let a short transition finish the job.
<section class="w4cvt-root">
<div class="w4cvt-head">
<p class="w4cvt-label">Harlow Street Gallery, winter show</p>
<div class="w4cvt-row">
<h2>Four rooms, one floor</h2>
<a href="#" class="w4cvt-btn">Plan your visit</a>
</div>
</div>
<div class="w4cvt-deck" data-w4cvt tabindex="0" role="region" aria-label="Exhibition rooms, scrollable">
<div class="w4cvt-hint" aria-hidden="true"><span>Scroll inside</span></div>
<ul class="w4cvt-list">
<li class="w4cvt-card" style="--i:0"><article class="w4cvt-face" style="--bg:#ffffff;--ink:#1b2433;--sub:#4b5565">
<div class="w4cvt-top"><span>Room 1</span><span>14 works</span></div>
<h3>Salt and slate</h3>
<p>Coastal paintings from the north shore, hung low so you meet the horizon at eye level.</p>
<span class="w4cvt-shade" aria-hidden="true"></span>
</article></li>
<li class="w4cvt-card" style="--i:1"><article class="w4cvt-face" style="--bg:#1f3a5f;--ink:#f2f5f9;--sub:#c6d2e2">
<div class="w4cvt-top"><span>Room 2</span><span>22 pieces</span></div>
<h3>The weavers' table</h3>
<p>Hand-loomed wool from three generations of one family, laid flat under soft daylight.</p>
<span class="w4cvt-shade" aria-hidden="true"></span>
</article></li>
<li class="w4cvt-card" style="--i:2"><article class="w4cvt-face" style="--bg:#dfe6ee;--ink:#1b2433;--sub:#465163">
<div class="w4cvt-top"><span>Room 3</span><span>9 prints</span></div>
<h3>Small hours</h3>
<p>Night photographs of an empty market town, printed small and hung far apart.</p>
<span class="w4cvt-shade" aria-hidden="true"></span>
</article></li>
<li class="w4cvt-card" style="--i:3"><article class="w4cvt-face" style="--bg:#121a26;--ink:#eef2f7;--sub:#b4bfcd">
<div class="w4cvt-top"><span>Room 4</span><span>31 objects</span></div>
<h3>Kiln marks</h3>
<p>Stoneware bowls shown with the shelves they were fired on, ash glaze and all.</p>
<span class="w4cvt-shade" aria-hidden="true"></span>
</article></li>
</ul>
</div>
</section>
<style>
/* Change these: --h (card height; every card must fit inside it), --g (gap between cards),
--p (pin line, also the deck's top padding) and the sink depth in @keyframes w4cvt-sink.
For page scroll: drop height/overflow on .w4cvt-deck and swap scroll(nearest block) for scroll(root block). */
.w4cvt-root { height: 640px; display: flex; flex-direction: column; background: #e8edf3; color: #1b2433; font-family: system-ui, sans-serif; }
.w4cvt-root *, .w4cvt-root *::before { box-sizing: border-box; }
.w4cvt-head { width: 100%; max-width: 44rem; margin: 0 auto; padding: 40px 20px 24px; }
.w4cvt-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #1f3a5f; }
.w4cvt-row { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.w4cvt-row h2 { margin: 0; font-size: clamp(1.875rem, 4vw, 2.25rem); font-weight: 600; letter-spacing: -.02em; }
.w4cvt-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 999px; background: #1f3a5f; color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; }
.w4cvt-btn:hover { background: #2b4c78; }
.w4cvt-btn:focus-visible { outline: 2px solid #1f3a5f; outline-offset: 3px; }
.w4cvt-deck { --h: 340px; --g: 24px; --p: 24px; position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: var(--p) 20px 150px;
scrollbar-width: thin; scrollbar-color: #b9c4d2 transparent; }
.w4cvt-deck:focus-visible { outline: 3px solid #1f3a5f; outline-offset: -3px; }
.w4cvt-hint { position: sticky; top: 0; z-index: 20; height: 0; display: flex; justify-content: center; pointer-events: none; transition: opacity .4s ease; }
.w4cvt-hint span { margin-top: -18px; padding: 3px 12px; border-radius: 999px; background: #1b2433; color: #f2f5f9; font-size: 12px; letter-spacing: .04em; }
.w4cvt-deck[data-scrolled] .w4cvt-hint { opacity: 0; }
.w4cvt-list { list-style: none; margin: 0 auto; padding: 0; max-width: 44rem; display: grid; gap: var(--g); }
.w4cvt-card { position: sticky; top: var(--p); height: var(--h); }
.w4cvt-face { position: relative; height: 100%; display: flex; flex-direction: column; padding: 28px; border-radius: 24px;
background: var(--bg); color: var(--ink); box-shadow: 0 24px 50px -26px rgba(15,23,42,.55); transform-origin: 50% 0; }
.w4cvt-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 500; color: var(--sub); }
.w4cvt-face h3 { margin: auto 0 0; font-size: clamp(2.25rem, 5vw, 3rem); font-weight: 600; letter-spacing: -.02em; line-height: 1.05; }
.w4cvt-face p { margin: 16px 0 0; max-width: 28rem; font-size: 15px; line-height: 1.65; color: var(--sub); }
.w4cvt-shade { position: absolute; inset: 0; border-radius: inherit; background: #0b111a; opacity: 0; pointer-events: none; }
@media (min-width: 640px) { .w4cvt-face { padding: 36px; } }
.w4cvt-deck[data-fallback] .w4cvt-face, .w4cvt-deck[data-fallback] .w4cvt-shade { transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .5s ease; }
.w4cvt-deck[data-fallback] .w4cvt-card[data-under] .w4cvt-face { transform: scale(.92); }
.w4cvt-deck[data-fallback] .w4cvt-card[data-under] .w4cvt-shade { opacity: .45; }
@supports (animation-timeline: scroll()) {
.w4cvt-face, .w4cvt-shade { animation-timing-function: linear; animation-fill-mode: both; animation-timeline: scroll(nearest block);
animation-range: calc(var(--i) * (var(--h) + var(--g)) + var(--g)) calc((var(--i) + 1) * (var(--h) + var(--g))); }
.w4cvt-face { animation-name: w4cvt-sink; }
.w4cvt-shade { animation-name: w4cvt-dim; }
.w4cvt-card:last-child .w4cvt-face, .w4cvt-card:last-child .w4cvt-shade { animation: none; }
.w4cvt-hint { animation: w4cvt-hide linear both; animation-timeline: scroll(nearest block); animation-range: 0 40px; }
}
@keyframes w4cvt-sink { to { transform: scale(.92); } }
@keyframes w4cvt-dim { to { opacity: .45; } }
@keyframes w4cvt-hide { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
.w4cvt-face, .w4cvt-shade, .w4cvt-hint { animation: none !important; transition: none !important; transform: none !important; }
.w4cvt-shade { opacity: 0 !important; } .w4cvt-hint { display: none; }
}
</style>
<script>
/* Fallback only: browsers with scroll-driven animations never run past the first check. */
(function () {
var deck = document.querySelector("[data-w4cvt]");
if (!deck || (window.CSS && CSS.supports("animation-timeline: scroll()")) || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
deck.setAttribute("data-fallback", "");
var cards = [].slice.call(deck.querySelectorAll(".w4cvt-card"));
// A thin band from the top of the deck down to the pin line: a card inside it has pinned over the one before.
var band = deck.clientHeight - parseFloat(getComputedStyle(cards[0]).top) - 2;
var io = new IntersectionObserver(function (entries) {
entries.forEach(function (e) {
var prev = cards[cards.indexOf(e.target) - 1];
if (prev) prev.toggleAttribute("data-under", e.isIntersecting);
});
}, { root: deck, rootMargin: "0px 0px -" + band + "px 0px" });
cards.slice(1).forEach(function (c) { io.observe(c); });
deck.addEventListener("scroll", function () { deck.toggleAttribute("data-scrolled", deck.scrollTop > 8); }, { passive: true });
})();
</script>
With reduced motion: Rooms pin and overlap at full size and brightness, with the timeline animations switched off.
Running cost: Runs on the browser's scroll timeline with no script at all where supported; the fallback touches one attribute per card.
- Keep `--h` taller than your longest card content, since the timeline maths relies on every card being the same height.
- Set `--i` on each card in order starting at 0; add a card by giving it the next number.
- Deepen the pile by lowering the scale in `@keyframes w4cvt-sink`, or the shade in `w4cvt-dim`.
Dark Product Feature Cards Stacking on Scroll
A graphite product page for a field recorder where each feature card pins and the ones beneath lift a little, shrink and sink into shadow, leaving a fan of top edges above the current card. The card in front picks up a soft copper rim of light. Each card pairs copy with a drawn detail: a waveform, a gain dial, a battery and a file list.
<section class="w4dpf-root" data-w4dpf tabindex="0" aria-label="Recorder features, scrollable">
<div class="w4dpf-hint" aria-hidden="true"><span>Scroll inside</span></div>
<div class="w4dpf-wrap">
<p class="w4dpf-label">Wrenfield R2 field recorder</p>
<h2>Built for interviews that happen outdoors</h2>
<ul class="w4dpf-list">
<li class="w4dpf-card"><article class="w4dpf-face">
<div class="w4dpf-copy">
<p class="w4dpf-kicker">Inputs</p>
<h3>Two microphones, one clean take</h3>
<p class="w4dpf-text">Plug in a lapel mic and a shotgun at once. Each one records to its own track, so a cough on one never ruins the other.</p>
<p class="w4dpf-spec">2 locking XLR inputs</p>
</div>
<div class="w4dpf-vis" aria-hidden="true"><div class="w4dpf-wave">
<span style="height:18%"></span><span style="height:34%"></span><span style="height:52%"></span><span style="height:40%"></span><span style="height:70%"></span>
<span style="height:88%"></span><span style="height:60%"></span><span style="height:46%"></span><span style="height:74%"></span><span style="height:96%"></span>
<span style="height:80%"></span><span style="height:58%"></span><span style="height:42%"></span><span style="height:66%"></span><span style="height:84%"></span>
<span style="height:62%"></span><span style="height:38%"></span><span style="height:54%"></span><span style="height:72%"></span><span style="height:50%"></span>
</div></div>
<span class="w4dpf-glow" aria-hidden="true"></span><span class="w4dpf-shade" aria-hidden="true"></span>
</article></li>
<li class="w4dpf-card"><article class="w4dpf-face">
<div class="w4dpf-copy">
<p class="w4dpf-kicker">Control</p>
<h3>A gain dial you can find blind</h3>
<p class="w4dpf-text">The large knob clicks in half-decibel steps and stays where you left it, even in a coat pocket on a windy walk.</p>
<p class="w4dpf-spec">Detented, 60 steps</p>
</div>
<div class="w4dpf-vis" aria-hidden="true"><div class="w4dpf-dial"><i class="w4dpf-ticks"></i><i class="w4dpf-knob"><b></b></i></div></div>
<span class="w4dpf-glow" aria-hidden="true"></span><span class="w4dpf-shade" aria-hidden="true"></span>
</article></li>
<li class="w4dpf-card"><article class="w4dpf-face">
<div class="w4dpf-copy">
<p class="w4dpf-kicker">Battery</p>
<h3>A long day on one charge</h3>
<p class="w4dpf-text">Record from first light to the last interview and charge from any USB-C brick while it keeps running.</p>
<p class="w4dpf-spec">USB-C, records while charging</p>
</div>
<div class="w4dpf-vis" aria-hidden="true"><div class="w4dpf-batt"><div><span></span><span></span><span></span><span></span><span class="w4dpf-off"></span></div><i></i></div></div>
<span class="w4dpf-glow" aria-hidden="true"></span><span class="w4dpf-shade" aria-hidden="true"></span>
</article></li>
<li class="w4dpf-card"><article class="w4dpf-face">
<div class="w4dpf-copy">
<p class="w4dpf-kicker">Files</p>
<h3>Takes named the way you think</h3>
<p class="w4dpf-text">Say a short label after you press stop and the file is named for it, ready to drag into your editor.</p>
<p class="w4dpf-spec">WAV and MP3 side by side</p>
</div>
<div class="w4dpf-vis" aria-hidden="true"><ul class="w4dpf-files">
<li class="w4dpf-on"><span>Bakery owner, part 1.wav</span><code>18:42</code></li>
<li><span>Street ambience.wav</span><code>04:10</code></li>
<li><span>Bakery owner, part 2.wav</span><code>22:05</code></li>
</ul></div>
<span class="w4dpf-glow" aria-hidden="true"></span><span class="w4dpf-shade" aria-hidden="true"></span>
</article></li>
</ul>
<a href="#" class="w4dpf-btn">See the full spec sheet</a>
</div>
</section>
<style>
/* Change these: --w4dpf-copper (accent, glow and visuals), --w4dpf-bg (panel), --w4dpf-stick (pin line),
and LIFT / SCALE_STEP in the script for how the buried cards stack up. */
.w4dpf-root { --w4dpf-copper: #d9895a; --w4dpf-bg: #121212; --w4dpf-stick: 72px; height: 640px; overflow-y: auto; position: relative;
background: var(--w4dpf-bg); color: #ece6dc; font-family: system-ui, sans-serif; scrollbar-width: thin; scrollbar-color: #3a3632 transparent; }
.w4dpf-root *, .w4dpf-root *::before { box-sizing: border-box; }
.w4dpf-root:focus-visible { outline: 3px solid var(--w4dpf-copper); outline-offset: -3px; }
.w4dpf-hint { position: sticky; top: 0; z-index: 20; height: 0; display: flex; justify-content: center; pointer-events: none; transition: opacity .4s ease; }
.w4dpf-hint span { margin-top: 10px; padding: 4px 12px; border-radius: 999px; background: #2a2724; color: #ece6dc; font-size: 12px; letter-spacing: .04em; }
.w4dpf-root[data-scrolled] .w4dpf-hint { opacity: 0; }
.w4dpf-wrap { max-width: 64rem; margin: 0 auto; padding: 48px 20px 112px; }
.w4dpf-label, .w4dpf-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--w4dpf-copper); }
.w4dpf-wrap h2 { margin: 12px 0 0; max-width: 36rem; font-size: clamp(1.875rem, 4vw, 2.25rem); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.w4dpf-list { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 32px; }
.w4dpf-card { position: sticky; top: var(--w4dpf-stick); }
.w4dpf-face { position: relative; display: grid; overflow: hidden; border-radius: 24px; border: 1px solid rgba(255,255,255,.1);
background: linear-gradient(#1f1d1b, #171615); transform-origin: 50% 0; will-change: transform; }
.w4dpf-copy { display: flex; flex-direction: column; padding: 28px; }
.w4dpf-copy h3 { margin: 12px 0 0; font-size: clamp(1.5rem, 2.6vw, 1.75rem); font-weight: 600; line-height: 1.3; }
.w4dpf-text { margin: 12px 0 0; font-size: 15px; line-height: 1.65; color: #b9b1a5; }
.w4dpf-spec { margin: 24px 0 0; align-self: flex-start; padding: 4px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.15);
font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: #d8d1c6; }
.w4dpf-vis { position: relative; height: 192px; border-top: 1px solid rgba(255,255,255,.1); background: #141312; display: grid; place-items: center; }
.w4dpf-wave { display: flex; align-items: center; justify-content: center; gap: 6px; height: 100%; width: 100%; padding: 15% 24px; }
.w4dpf-wave span { width: 6px; border-radius: 999px; background: var(--w4dpf-copper); opacity: .8; }
.w4dpf-dial { position: relative; width: 160px; height: 160px; }
.w4dpf-dial i { position: absolute; border-radius: 50%; }
.w4dpf-ticks { inset: 0; background: repeating-conic-gradient(#6b6660 0 1.5deg, transparent 1.5deg 10deg);
-webkit-mask: radial-gradient(circle, transparent 64%, #000 65%); mask: radial-gradient(circle, transparent 64%, #000 65%); }
.w4dpf-knob { inset: 24px; background: linear-gradient(#3a3733, #201e1c); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 12px 24px rgba(0,0,0,.5); transform: rotate(38deg); }
.w4dpf-knob b { position: absolute; left: 50%; top: 8px; width: 4px; height: 32px; margin-left: -2px; border-radius: 999px; background: var(--w4dpf-copper); }
.w4dpf-batt { display: flex; align-items: center; }
.w4dpf-batt div { display: flex; gap: 6px; padding: 8px; border: 2px solid #6b6660; border-radius: 12px; }
.w4dpf-batt span { width: 28px; height: 56px; border-radius: 6px; background: var(--w4dpf-copper); }
.w4dpf-batt .w4dpf-off { background: #2e2b28; }
.w4dpf-batt i { width: 6px; height: 24px; margin-left: 4px; border-radius: 0 4px 4px 0; background: #6b6660; }
.w4dpf-files { list-style: none; margin: 0; padding: 0 24px; width: 100%; display: grid; gap: 8px; font-size: 14px; }
.w4dpf-files li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; background: #262321; color: #d8d1c6; }
.w4dpf-files li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w4dpf-files .w4dpf-on { background: var(--w4dpf-copper); color: #1a1816; }
.w4dpf-files code { font-size: 12px; }
.w4dpf-shade { position: absolute; inset: 0; border-radius: inherit; background: #050505; opacity: 0; pointer-events: none; }
.w4dpf-glow { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
box-shadow: inset 0 1px 0 rgba(217,137,90,.55), 0 30px 80px -30px rgba(217,137,90,.45); }
.w4dpf-btn { margin-top: 56px; display: inline-flex; align-items: center; min-height: 44px; padding: 0 24px; border-radius: 999px;
background: #ece6dc; color: #121212; font-size: 14px; font-weight: 600; text-decoration: none; }
.w4dpf-btn:hover { background: #fff; }
.w4dpf-btn:focus-visible { outline: 2px solid var(--w4dpf-copper); outline-offset: 3px; }
@media (min-width: 640px) { .w4dpf-wrap { padding: 48px 32px 112px; } .w4dpf-copy { padding: 36px; } }
@media (min-width: 768px) { .w4dpf-face { grid-template-columns: 1fr 1fr; } .w4dpf-vis { height: auto; min-height: 300px; border-top: 0; border-left: 1px solid rgba(255,255,255,.1); }
.w4dpf-spec { margin-top: auto; } }
@media (prefers-reduced-motion: reduce) { .w4dpf-face { transform: none !important; } .w4dpf-shade { opacity: 0 !important; } .w4dpf-glow { opacity: .6 !important; } .w4dpf-hint { display: none; } }
</style>
<script>
(function () {
var root = document.querySelector("[data-w4dpf]");
if (!root || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
var SCALE_STEP = 0.05; // shrink per covering card
var LIFT = 16; // px each buried card rises so its top edge shows
var AUTO = 30; // demo scroll speed in px per second; 0 turns it off
// The box scrolls itself. For page scroll: drop height and overflow on .w4dpf-root and set sc = null.
var sc = root;
var cards = [].slice.call(root.querySelectorAll(".w4dpf-card"));
var raf = 0;
function paint() {
raf = 0;
var top = sc ? sc.getBoundingClientRect().top : 0;
var cover = cards.map(function (c) {
var d = c.getBoundingClientRect().top - top - parseFloat(getComputedStyle(c).top);
return Math.min(1, Math.max(0, 1 - d / c.offsetHeight));
});
cards.forEach(function (c, i) {
var depth = 0;
for (var j = i + 1; j < cards.length; j++) depth += cover[j];
c.firstElementChild.style.transform = "translateY(" + (-LIFT * depth) + "px) scale(" + (1 - SCALE_STEP * depth) + ")";
c.querySelector(".w4dpf-shade").style.opacity = Math.min(0.7, 0.35 * depth);
c.querySelector(".w4dpf-glow").style.opacity = cover[i] * Math.max(0, 1 - depth);
});
root.toggleAttribute("data-scrolled", (sc ? sc.scrollTop : scrollY) > 8);
}
(sc || window).addEventListener("scroll", function () { if (!raf) raf = requestAnimationFrame(paint); }, { passive: true });
paint();
if (!sc || !AUTO) return;
var demo = 0, last = 0, pos = sc.scrollTop, seen = true, done = false;
function step(now) {
var dt = last ? Math.min(now - last, 50) : 0;
last = now;
pos += AUTO * dt / 1000;
if (pos >= sc.scrollHeight - sc.clientHeight) { done = true; demo = 0; return; }
sc.scrollTop = pos;
demo = requestAnimationFrame(step);
}
function start() { if (!done && seen && !demo) { last = 0; demo = requestAnimationFrame(step); } }
function stop() { cancelAnimationFrame(demo); demo = 0; }
new IntersectionObserver(function (e) { seen = e[0].isIntersecting; seen ? start() : stop(); }).observe(sc);
["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (ev) {
sc.addEventListener(ev, function () { done = true; stop(); }, { passive: true });
});
start();
})();
</script>
With reduced motion: Every card shows its copper rim at rest and pins in order with no lifting, shrinking or shadow.
Running cost: Each scrolled frame sets one transform and two opacities per card; the glow is a pre-drawn shadow layer that only fades.
- Raise `LIFT` to show more of each buried card's top edge, or set it to 0 for a flat pile.
- Change `--w4dpf-copper` to recolour the accent, glow and every drawn visual together.
- Edit copy and the spec pill per card in the `features` array.
Horizontal Card Deck Stacking Sideways in a Pinned Section
A walking holiday's five days pinned in one clay-red section: scrolling down slides each day in from the right edge, where the next card always waits half hidden, and drops it onto a sideways pile. Earlier days shrink and shade a little but keep a sliver showing, so the route builds up left to right as you read.
<section class="w4hds-root" data-w4hds tabindex="0" aria-label="Five day walking route, scrollable">
<div class="w4hds-track">
<div class="w4hds-stage">
<div class="w4hds-hint" aria-hidden="true"><span>Scroll inside</span></div>
<div class="w4hds-grid">
<div>
<p class="w4hds-label">Coldharbour Walks</p>
<h2>The Hollin Way in five days</h2>
<p class="w4hds-lede">Bags carried between stops, rooms booked, a map for each morning. You only walk.</p>
<a href="#" class="w4hds-btn">Check spring dates</a>
</div>
<div class="w4hds-deck">
<article class="w4hds-card"><p class="w4hds-day">Day 1</p><h3>Ashby Gate to Fellmoor</h3>
<div class="w4hds-chips"><span>16 km</span><span>340 m up</span></div>
<p class="w4hds-text">A gentle start along the old drove road, through two farms and over a stone stile into open moor.</p>
<p class="w4hds-stay"><span>Overnight: </span><b>Fellmoor bunkhouse</b></p><span class="w4hds-shade" aria-hidden="true"></span></article>
<article class="w4hds-card"><p class="w4hds-day">Day 2</p><h3>Fellmoor to Tarn Hollow</h3>
<div class="w4hds-chips"><span>19 km</span><span>520 m up</span></div>
<p class="w4hds-text">The longest climb of the week, rewarded with lunch beside a still tarn and a slow walk down.</p>
<p class="w4hds-stay"><span>Overnight: </span><b>The Hollow Inn</b></p><span class="w4hds-shade" aria-hidden="true"></span></article>
<article class="w4hds-card"><p class="w4hds-day">Day 3</p><h3>Tarn Hollow to Brindle</h3>
<div class="w4hds-chips"><span>12 km</span><span>180 m up</span></div>
<p class="w4hds-text">A short, easy day through beech woods with time for the village bakery before it closes.</p>
<p class="w4hds-stay"><span>Overnight: </span><b>Mill House rooms</b></p><span class="w4hds-shade" aria-hidden="true"></span></article>
<article class="w4hds-card"><p class="w4hds-day">Day 4</p><h3>Brindle to Hawes Edge</h3>
<div class="w4hds-chips"><span>21 km</span><span>610 m up</span></div>
<p class="w4hds-text">Ridge walking with wide views both ways. Carry water; there is no village until the end.</p>
<p class="w4hds-stay"><span>Overnight: </span><b>Edge Farm barn</b></p><span class="w4hds-shade" aria-hidden="true"></span></article>
<article class="w4hds-card"><p class="w4hds-day">Day 5</p><h3>Hawes Edge to Kirkby</h3>
<div class="w4hds-chips"><span>14 km</span><span>90 m up</span></div>
<p class="w4hds-text">Downhill nearly all the way to the market square, with a train home from the station.</p>
<p class="w4hds-stay"><span>Overnight: </span><b>Your own bed</b></p><span class="w4hds-shade" aria-hidden="true"></span></article>
</div>
</div>
</div>
</div>
</section>
<style>
/* Change these: --w4hds-clay (background), --w4hds-step (scroll distance per card; keep it equal to STEP in the script),
the card width in .w4hds-card, and PEEK in the script (how much of the next card waits at the right edge). */
.w4hds-root { --w4hds-clay: #6e3020; --w4hds-step: 380px; height: 620px; overflow-y: auto; overflow-x: hidden; position: relative;
background: var(--w4hds-clay); color: #f8efe3; font-family: system-ui, sans-serif; scrollbar-width: thin; scrollbar-color: #9a5a44 transparent; }
.w4hds-root *, .w4hds-root *::before { box-sizing: border-box; }
.w4hds-root:focus-visible { outline: 3px solid #f3c99b; outline-offset: -3px; }
.w4hds-track { height: calc(620px + 4 * var(--w4hds-step)); }
.w4hds-stage { position: sticky; top: 0; height: 620px; overflow: hidden; }
.w4hds-hint { position: absolute; top: 10px; left: 0; right: 0; z-index: 20; display: flex; justify-content: center; pointer-events: none; transition: opacity .4s ease; }
.w4hds-hint span { padding: 4px 12px; border-radius: 999px; background: #f8efe3; color: var(--w4hds-clay); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.w4hds-root[data-scrolled] .w4hds-hint { opacity: 0; }
.w4hds-grid { max-width: 72rem; height: 100%; margin: 0 auto; padding: 24px 20px; display: grid; align-content: center; gap: 24px; }
.w4hds-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #f3c99b; }
.w4hds-grid h2 { margin: 12px 0 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(1.875rem, 4vw, 2.25rem); line-height: 1.15; }
.w4hds-lede { display: none; margin: 12px 0 0; font-size: 15px; line-height: 1.65; color: #ecd9c6; }
.w4hds-btn { margin-top: 20px; display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 999px;
background: #f8efe3; color: var(--w4hds-clay); font-size: 14px; font-weight: 600; text-decoration: none; }
.w4hds-btn:hover { background: #fff; }
.w4hds-btn:focus-visible { outline: 2px solid #f3c99b; outline-offset: 3px; }
.w4hds-deck { position: relative; height: 330px; overflow: hidden; }
.w4hds-card { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; width: min(calc(100% - 56px), 420px); height: 320px;
padding: 24px; border-radius: 24px; background: #fbf5ec; color: #3a1d14; box-shadow: -18px 0 40px -24px rgba(0,0,0,.6);
transform-origin: 0 50%; will-change: transform; }
.w4hds-card:not(:first-child) { transform: translateX(200%); }
.w4hds-day { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: #9a4a2e; }
.w4hds-card h3 { margin: 8px 0 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(1.5rem, 2.6vw, 1.75rem); line-height: 1.3; }
.w4hds-chips { margin-top: 16px; display: flex; gap: 8px; font-size: 12px; font-weight: 600; }
.w4hds-chips span { padding: 4px 12px; border-radius: 999px; background: #f1e2d0; }
.w4hds-text { margin: 16px 0 0; font-size: 15px; line-height: 1.65; color: #5c3a2d; }
.w4hds-stay { margin: auto 0 0; padding-top: 16px; border-top: 1px solid #ead8c4; font-size: 14px; }
.w4hds-stay span { color: #7a5444; }
.w4hds-shade { position: absolute; inset: 0; border-radius: inherit; background: #2a120b; opacity: 0; pointer-events: none; }
@media (min-width: 640px) { .w4hds-card { padding: 32px; } }
@media (min-width: 768px) { .w4hds-grid { grid-template-columns: 260px minmax(0, 1fr); align-items: center; gap: 40px; padding: 24px 40px; }
.w4hds-lede { display: block; } .w4hds-deck { height: 380px; } .w4hds-card { height: 380px; } }
@media (prefers-reduced-motion: reduce) {
.w4hds-track { height: auto; } .w4hds-stage { position: static; height: auto; } .w4hds-hint { display: none; }
.w4hds-deck { display: flex; gap: 16px; overflow-x: auto; height: auto !important; padding-bottom: 12px; }
.w4hds-card { position: relative; flex: 0 0 min(85%, 340px); transform: none !important; }
}
</style>
<script>
(function () {
var root = document.querySelector("[data-w4hds]");
if (!root || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
var PEEK = 56; // least amount of the next card that shows at the right edge
var STEP = 380; // scroll distance that brings in one card (match --w4hds-step)
var AUTO = 60; // demo scroll speed in px per second; 0 turns it off
// The box scrolls itself. For page scroll: drop height/overflow on .w4hds-root, make the stage 100vh,
// and read scrollY minus the track's page offset instead of root.scrollTop.
var deck = root.querySelector(".w4hds-deck");
var cards = [].slice.call(deck.children), n = cards.length, raf = 0;
function paint() {
raf = 0;
var p = Math.min(n - 1, Math.max(0, root.scrollTop / STEP));
var w = deck.clientWidth;
var cw = cards[0].offsetWidth, off = Math.min(28, Math.max(0, (w - cw - 8) / (n - 1)));
var wait = Math.min(w - PEEK, cw + 40); // where the next card waits
var enter = cards.map(function (c, k) { return k ? Math.min(1, p - (k - 1)) : 1; });
cards.forEach(function (c, k) {
var e = enter[k], ease = e > 0 ? 1 - Math.pow(1 - e, 3) : 0;
var x = e <= 0 ? w - (w - wait) * Math.max(0, 1 + e) : wait + (k * off - wait) * ease;
var depth = 0;
for (var j = k + 1; j < n; j++) depth += Math.max(0, enter[j]);
c.style.transform = "translateX(" + x + "px) scale(" + (1 - 0.05 * depth) + ")";
c.querySelector(".w4hds-shade").style.opacity = Math.min(0.55, 0.22 * depth);
});
root.toggleAttribute("data-scrolled", root.scrollTop > 8);
}
function queue() { if (!raf) raf = requestAnimationFrame(paint); }
root.addEventListener("scroll", queue, { passive: true });
new ResizeObserver(queue).observe(deck);
paint();
if (!AUTO) return;
var demo = 0, last = 0, pos = root.scrollTop, seen = true, done = false;
function step(now) {
var dt = last ? Math.min(now - last, 50) : 0;
last = now;
pos += AUTO * dt / 1000;
if (pos >= root.scrollHeight - root.clientHeight) { done = true; demo = 0; return; }
root.scrollTop = pos;
demo = requestAnimationFrame(step);
}
function start() { if (!done && seen && !demo) { last = 0; demo = requestAnimationFrame(step); } }
function stop() { cancelAnimationFrame(demo); demo = 0; }
new IntersectionObserver(function (e) { seen = e[0].isIntersecting; seen ? start() : stop(); }).observe(root);
["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (ev) {
root.addEventListener(ev, function () { done = true; stop(); }, { passive: true });
});
start();
})();
</script>
With reduced motion: The pin is dropped and all five days sit side by side in a row you can swipe or scroll across.
Running cost: One rAF-throttled pass per scroll moves five cards with transform and fades five shade layers.
- Set `STEP` (and `--w4hds-step` in the HTML version) to the scroll distance each card needs; the track grows to match.
- Change `PEEK` to set the least amount of the waiting card that shows at the right edge on narrow screens.
- Edit days, distances and overnight stops in the `days` array, and the panel colour with `--w4hds-clay`.
Numbered Process Steps Stacking With Peeking Headers
Four install steps for a solar fitter pin at stepped heights, so each new card stops a header's height lower than the last. Earlier steps stay visible as a ladder of numbered strips while their bodies fade back. By the final step the whole route reads at a glance, on a deep navy panel with an amber accent.
<section class="w4nps-root" data-w4nps tabindex="0" aria-label="How an install works, scrollable">
<div class="w4nps-hint" aria-hidden="true"><span>Scroll inside</span></div>
<div class="w4nps-wrap">
<div class="w4nps-head">
<div>
<p class="w4nps-label">Northpoint Solar</p>
<h2>From first visit to switch on</h2>
</div>
<a href="#" class="w4nps-btn">Book a roof survey</a>
</div>
<ol class="w4nps-list">
<li class="w4nps-card" style="--i:0"><article class="w4nps-face">
<header><span class="w4nps-num">01</span><h3>Roof survey</h3><span class="w4nps-time">One visit</span></header>
<div class="w4nps-body">
<div><p class="w4nps-time-sm">One visit</p><p>An installer climbs up, measures every face of the roof and checks the rafters and the fuse board before anything is drawn.</p></div>
<div class="w4nps-gets"><p>You get</p><ul><li>Photos of each roof face</li><li>A note on any repairs needed first</li></ul></div>
</div>
<span class="w4nps-shade" aria-hidden="true"></span>
</article></li>
<li class="w4nps-card" style="--i:1"><article class="w4nps-face">
<header><span class="w4nps-num">02</span><h3>Panel layout</h3><span class="w4nps-time">About three days</span></header>
<div class="w4nps-body">
<div><p class="w4nps-time-sm">About three days</p><p>We draw where each panel sits, how the cables run and where the inverter hangs, then walk you through it on a call.</p></div>
<div class="w4nps-gets"><p>You get</p><ul><li>A drawn layout you can mark up</li><li>A fixed price that will not change</li></ul></div>
</div>
<span class="w4nps-shade" aria-hidden="true"></span>
</article></li>
<li class="w4nps-card" style="--i:2"><article class="w4nps-face">
<header><span class="w4nps-num">03</span><h3>Permits and grid sign-off</h3><span class="w4nps-time">Two to four weeks</span></header>
<div class="w4nps-body">
<div><p class="w4nps-time-sm">Two to four weeks</p><p>We file the paperwork with the council and the network operator and chase it, so you only hear from us when it is approved.</p></div>
<div class="w4nps-gets"><p>You get</p><ul><li>Every form filed for you</li><li>A date for install day</li></ul></div>
</div>
<span class="w4nps-shade" aria-hidden="true"></span>
</article></li>
<li class="w4nps-card" style="--i:3"><article class="w4nps-face">
<header><span class="w4nps-num">04</span><h3>Install day</h3><span class="w4nps-time">One day</span></header>
<div class="w4nps-body">
<div><p class="w4nps-time-sm">One day</p><p>Scaffold goes up early, panels are fixed by lunch and the system is switched on and tested with you before the team leaves.</p></div>
<div class="w4nps-gets"><p>You get</p><ul><li>A live system and handover pack</li><li>The monitoring app set up on your phone</li></ul></div>
</div>
<span class="w4nps-shade" aria-hidden="true"></span>
</article></li>
</ol>
</div>
</section>
<style>
/* Change these: --w4nps-base (pin line of the first card), --w4nps-peek (visible strip of each earlier card;
keep it equal to the header height), --w4nps-navy (background) and --w4nps-amber (accent). */
.w4nps-root { --w4nps-base: 24px; --w4nps-peek: 64px; --w4nps-navy: #0f1d33; --w4nps-amber: #f2b84b;
height: 640px; overflow-y: auto; position: relative; background: var(--w4nps-navy); color: #eef1f6; font-family: system-ui, sans-serif;
scrollbar-width: thin; scrollbar-color: #2c3e5c transparent; }
.w4nps-root *, .w4nps-root *::before { box-sizing: border-box; }
.w4nps-root:focus-visible { outline: 3px solid var(--w4nps-amber); outline-offset: -3px; }
.w4nps-hint { position: sticky; top: 0; z-index: 20; height: 0; display: flex; justify-content: center; pointer-events: none; transition: opacity .4s ease; }
.w4nps-hint span { margin-top: 6px; padding: 3px 12px; border-radius: 999px; background: var(--w4nps-amber); color: var(--w4nps-navy); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.w4nps-root[data-scrolled] .w4nps-hint { opacity: 0; }
.w4nps-wrap { max-width: 48rem; margin: 0 auto; padding: 48px 20px 112px; }
.w4nps-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.w4nps-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--w4nps-amber); }
.w4nps-head h2 { margin: 12px 0 0; font-size: clamp(1.875rem, 4vw, 2.25rem); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.w4nps-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 8px; background: var(--w4nps-amber);
color: var(--w4nps-navy); font-size: 14px; font-weight: 600; text-decoration: none; }
.w4nps-btn:hover { background: #f6c96f; }
.w4nps-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.w4nps-list { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 24px; }
.w4nps-card { position: sticky; top: calc(var(--w4nps-base) + var(--i) * var(--w4nps-peek)); }
.w4nps-face { position: relative; border-radius: 16px; background: #f4f1ea; color: #13223b;
box-shadow: 0 -12px 30px -18px rgba(0,0,0,.6), 0 24px 40px -24px rgba(0,0,0,.6); }
.w4nps-face header { display: flex; align-items: center; gap: 16px; height: var(--w4nps-peek); padding: 0 24px; border-bottom: 1px solid #ddd6c8; }
.w4nps-num { font-family: ui-monospace, Menlo, monospace; font-size: 14px; font-weight: 600; color: #a05f00; }
.w4nps-face h3 { flex: 1; min-width: 0; margin: 0; font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w4nps-time { display: none; font-size: 14px; color: #4a5568; }
.w4nps-body { display: grid; gap: 24px; padding: 24px; }
.w4nps-body p { margin: 4px 0 0; font-size: 15px; line-height: 1.65; }
.w4nps-body .w4nps-time-sm { margin: 0; font-size: 14px; font-weight: 500; color: #4a5568; }
.w4nps-gets { padding: 16px; border-radius: 12px; background: #e9e3d6; }
.w4nps-gets p { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #4a5568; }
.w4nps-gets ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.w4nps-shade { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(rgba(15,29,51,0) 64px, rgba(15,29,51,.14)); opacity: 0; pointer-events: none; }
@media (min-width: 640px) {
.w4nps-wrap { padding: 48px 32px 112px; } .w4nps-face header { padding: 0 32px; } .w4nps-time { display: inline; }
.w4nps-body { grid-template-columns: 1.3fr 1fr; padding: 28px 32px; } .w4nps-body .w4nps-time-sm { display: none; } .w4nps-body p { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) { .w4nps-body { opacity: 1 !important; } .w4nps-shade { opacity: 0 !important; } .w4nps-hint { display: none; } }
</style>
<script>
(function () {
var root = document.querySelector("[data-w4nps]");
if (!root || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
var FADE = 0.7; // how far a covered card's body fades
var AUTO = 32; // demo scroll speed in px per second; 0 turns it off
// The box scrolls itself. For page scroll: drop height and overflow on .w4nps-root and set sc = null.
var sc = root;
var cards = [].slice.call(root.querySelectorAll(".w4nps-card"));
var raf = 0;
function paint() {
raf = 0;
var top = sc ? sc.getBoundingClientRect().top : 0;
var peek = parseFloat(getComputedStyle(root).getPropertyValue("--w4nps-peek"));
var cover = cards.map(function (c) {
var d = c.getBoundingClientRect().top - top - parseFloat(getComputedStyle(c).top);
return Math.min(1, Math.max(0, 1 - d / (c.offsetHeight - peek)));
});
cards.forEach(function (c, i) {
var under = cover[i + 1] || 0;
c.querySelector(".w4nps-body").style.opacity = 1 - FADE * under;
c.querySelector(".w4nps-shade").style.opacity = under;
});
root.toggleAttribute("data-scrolled", (sc ? sc.scrollTop : scrollY) > 8);
}
(sc || window).addEventListener("scroll", function () { if (!raf) raf = requestAnimationFrame(paint); }, { passive: true });
paint();
if (!sc || !AUTO) return;
var demo = 0, last = 0, pos = sc.scrollTop, seen = true, done = false;
function step(now) {
var dt = last ? Math.min(now - last, 50) : 0;
last = now;
pos += AUTO * dt / 1000;
if (pos >= sc.scrollHeight - sc.clientHeight) { done = true; demo = 0; return; }
sc.scrollTop = pos;
demo = requestAnimationFrame(step);
}
function start() { if (!done && seen && !demo) { last = 0; demo = requestAnimationFrame(step); } }
function stop() { cancelAnimationFrame(demo); demo = 0; }
new IntersectionObserver(function (e) { seen = e[0].isIntersecting; seen ? start() : stop(); }).observe(sc);
["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (ev) {
sc.addEventListener(ev, function () { done = true; stop(); }, { passive: true });
});
start();
})();
</script>
With reduced motion: Steps still pin into the same stepped ladder, with every card body left at full strength.
Running cost: Only opacity changes, two values per step on each scrolled frame; nothing is scaled or repainted.
- Keep `--w4nps-peek` (or `PEEK` in React) equal to the header height, 64px here, so strips line up exactly.
- Move the whole ladder down with `--w4nps-base`, and soften the fade with `FADE`.
- Each step's title, duration and two deliverables live in the `steps` array.
Stacked Pricing Plan Cards That Pile Up on Scroll
Three bookkeeping plans pin one over another as the panel scrolls, so a visitor weighs a single plan at a time instead of scanning three narrow columns. A covered plan shrinks slightly and its text fades back, which keeps attention on the plan in front. On phones the price and the feature list stack inside each card.
<section class="w4spp-root" data-w4spp tabindex="0" aria-label="Pricing plans, scrollable">
<div class="w4spp-hint" aria-hidden="true"><span>Scroll inside</span></div>
<div class="w4spp-wrap">
<div class="w4spp-head">
<p class="w4spp-label">Tallyhouse pricing</p>
<h2>Pick the books you need to keep</h2>
<p class="w4spp-lede">Monthly prices in US dollars. Change plans or cancel from your settings at any time.</p>
</div>
<ul class="w4spp-list">
<li class="w4spp-card"><article class="w4spp-face">
<div class="w4spp-body">
<div>
<h3>Sole trader</h3>
<p class="w4spp-price"><b>$24</b><span>/month</span></p>
<p class="w4spp-blurb">For one person keeping their own books tidy between tax seasons.</p>
<a href="#" class="w4spp-btn">Start with Sole trader</a>
</div>
<ul class="w4spp-feat"><li>Bank feeds from two accounts</li><li>Receipt capture by photo</li><li>Quarterly tax estimate</li></ul>
</div>
</article></li>
<li class="w4spp-card"><article class="w4spp-face w4spp-dark">
<div class="w4spp-body">
<div>
<h3>Small team <span class="w4spp-badge">Most chosen</span></h3>
<p class="w4spp-price"><b>$68</b><span>/month</span></p>
<p class="w4spp-blurb">Payroll and invoicing for a shop with a handful of staff.</p>
<a href="#" class="w4spp-btn">Start with Small team</a>
</div>
<ul class="w4spp-feat"><li>Payroll for up to 12 people</li><li>Invoices with card payments</li><li>A bookkeeper checks each month</li></ul>
</div>
</article></li>
<li class="w4spp-card"><article class="w4spp-face">
<div class="w4spp-body">
<div>
<h3>Practice</h3>
<p class="w4spp-price"><b>$165</b><span>/month</span></p>
<p class="w4spp-blurb">For accountants who look after many clients from one login.</p>
<a href="#" class="w4spp-btn">Talk to us about Practice</a>
</div>
<ul class="w4spp-feat"><li>Unlimited client files</li><li>Review queue and sign-off</li><li>Shared notes on every entry</li></ul>
</div>
</article></li>
</ul>
<p class="w4spp-foot">Cancel anytime, and export your data whenever you like.</p>
</div>
</section>
<style>
/* Change these: --w4spp-accent (badge, ticks, focus), --w4spp-stick (pin line), and the
SCALE_STEP / FADE_STEP numbers in the script for how deep the pile looks. */
.w4spp-root { --w4spp-accent: #0f766e; --w4spp-stick: 32px; height: 640px; overflow-y: auto; position: relative;
background: #f8fafc; color: #0f172a; font-family: system-ui, sans-serif; scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.w4spp-root *, .w4spp-root *::before { box-sizing: border-box; }
.w4spp-root:focus-visible { outline: 3px solid var(--w4spp-accent); outline-offset: -3px; }
.w4spp-hint { position: sticky; top: 0; z-index: 20; height: 0; display: flex; justify-content: center; pointer-events: none; transition: opacity .4s ease; }
.w4spp-hint span { margin-top: 10px; padding: 4px 12px; border-radius: 999px; background: #0f172a; color: #f8fafc; font-size: 12px; letter-spacing: .04em; }
.w4spp-root[data-scrolled] .w4spp-hint { opacity: 0; }
.w4spp-wrap { max-width: 48rem; margin: 0 auto; padding: 48px 20px 80px; }
.w4spp-head { text-align: center; }
.w4spp-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--w4spp-accent); }
.w4spp-head h2 { margin: 12px 0 0; font-size: clamp(1.875rem, 4vw, 2.25rem); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.w4spp-lede { margin: 12px auto 0; max-width: 28rem; font-size: 15px; line-height: 1.6; color: #475569; }
.w4spp-list { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 24px; }
.w4spp-card { position: sticky; top: var(--w4spp-stick); }
.w4spp-face { padding: 24px; border-radius: 16px; border: 1px solid #e2e8f0; background: #fff; box-shadow: 0 24px 48px -28px rgba(15,23,42,.5);
transform-origin: 50% 0; will-change: transform; }
.w4spp-dark { background: #0f172a; border-color: #1e293b; color: #fff; }
.w4spp-body { display: grid; gap: 24px; }
.w4spp-face h3 { margin: 0; display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 600; }
.w4spp-badge { padding: 2px 10px; border-radius: 999px; background: rgba(45,212,191,.15); color: #5eead4; font-size: 12px; }
.w4spp-price { margin: 16px 0 0; display: flex; align-items: baseline; gap: 4px; color: #475569; }
.w4spp-price b { font-size: 48px; font-weight: 600; letter-spacing: -.03em; color: #0f172a; }
.w4spp-blurb { margin: 12px 0 0; font-size: 14px; line-height: 1.6; color: #475569; }
.w4spp-dark .w4spp-price, .w4spp-dark .w4spp-blurb { color: #cbd5e1; }
.w4spp-dark .w4spp-price b { color: #fff; }
.w4spp-btn { margin-top: 24px; display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 8px;
background: #0f172a; color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; }
.w4spp-dark .w4spp-btn { background: #2dd4bf; color: #0f172a; }
.w4spp-btn:focus-visible { outline: 2px solid var(--w4spp-accent); outline-offset: 3px; }
.w4spp-dark .w4spp-btn:focus-visible { outline-color: #5eead4; }
.w4spp-feat { list-style: none; margin: 0; padding: 20px 0 0; border-top: 1px solid #e2e8f0; display: grid; gap: 12px; align-content: start; font-size: 14px; }
.w4spp-dark .w4spp-feat { border-color: #334155; }
.w4spp-feat li { position: relative; padding-left: 32px; line-height: 1.5; }
.w4spp-feat li::before { content: ""; position: absolute; left: 4px; top: 3px; width: 11px; height: 6px; border: solid var(--w4spp-accent); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.w4spp-dark .w4spp-feat li::before { border-color: #5eead4; }
.w4spp-foot { margin: 40px 0 0; text-align: center; font-size: 14px; color: #475569; }
@media (min-width: 640px) {
.w4spp-wrap { padding: 48px 32px 80px; } .w4spp-face { padding: 32px; }
.w4spp-body { grid-template-columns: 1fr 1fr; gap: 40px; }
.w4spp-feat { border-top: 0; border-left: 1px solid #e2e8f0; padding: 4px 0 0 32px; }
}
@media (prefers-reduced-motion: reduce) { .w4spp-face { transform: none !important; } .w4spp-body { opacity: 1 !important; } .w4spp-hint { display: none; } }
</style>
<script>
(function () {
var root = document.querySelector("[data-w4spp]");
if (!root || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
var SCALE_STEP = 0.05; // shrink per card stacked on top
var FADE_STEP = 0.55; // how far a covered plan's text fades
var AUTO = 30; // demo scroll speed in px per second; 0 turns it off
// The box scrolls itself. For page scroll: drop height and overflow on .w4spp-root and set sc = null.
var sc = root;
var cards = [].slice.call(root.querySelectorAll(".w4spp-card"));
var raf = 0;
function paint() {
raf = 0;
var top = sc ? sc.getBoundingClientRect().top : 0;
var cover = cards.map(function (c) {
var d = c.getBoundingClientRect().top - top - parseFloat(getComputedStyle(c).top);
return Math.min(1, Math.max(0, 1 - d / c.offsetHeight));
});
cards.forEach(function (c, i) {
var depth = 0;
for (var j = i + 1; j < cards.length; j++) depth += cover[j];
c.firstElementChild.style.transform = "scale(" + (1 - SCALE_STEP * depth) + ")";
c.querySelector(".w4spp-body").style.opacity = 1 - FADE_STEP * Math.min(1, depth);
});
root.toggleAttribute("data-scrolled", (sc ? sc.scrollTop : scrollY) > 8);
}
(sc || window).addEventListener("scroll", function () { if (!raf) raf = requestAnimationFrame(paint); }, { passive: true });
paint();
if (!sc || !AUTO) return;
var demo = 0, last = 0, pos = sc.scrollTop, seen = true, done = false;
function step(now) {
var dt = last ? Math.min(now - last, 50) : 0;
last = now;
pos += AUTO * dt / 1000;
if (pos >= sc.scrollHeight - sc.clientHeight) { done = true; demo = 0; return; }
sc.scrollTop = pos;
demo = requestAnimationFrame(step);
}
function start() { if (!done && seen && !demo) { last = 0; demo = requestAnimationFrame(step); } }
function stop() { cancelAnimationFrame(demo); demo = 0; }
new IntersectionObserver(function (e) { seen = e[0].isIntersecting; seen ? start() : stop(); }).observe(sc);
["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (ev) {
sc.addEventListener(ev, function () { done = true; stop(); }, { passive: true });
});
start();
})();
</script>
With reduced motion: Plans pin and overlap in order at full size and full strength, with no fading and no demo scroll.
Running cost: A scroll handler throttled to one frame updates three transforms and three opacities, then sleeps.
- Change `FADE_STEP` to control how far a covered plan's text recedes, and `SCALE_STEP` for the shrink.
- Edit prices and features in the `plans` array (React) or straight in the markup.
- Swap the teal accent through `--w4spp-accent` and the dark card's `#2dd4bf` button.
Sticky Stacking Cards That Scale Down and Dim
Four bakery cards pin near the top of a scrolling panel, and each new card slides over the last. The card underneath shrinks a little and darkens under a shade layer, so the pile reads as real depth. A short intro column stays pinned beside the deck on wide screens and sits above it on phones.
<section class="w4scd-root" data-w4scd tabindex="0" aria-label="Breads this week, scrollable">
<div class="w4scd-hint" aria-hidden="true"><span>Scroll inside</span></div>
<div class="w4scd-wrap">
<div class="w4scd-intro">
<p class="w4scd-label">Larchmont Bakehouse</p>
<h2 class="w4scd-title">Four loaves on the shelf this week</h2>
<p class="w4scd-lede">Each one is mixed by hand the afternoon before and baked before the shop opens at seven.</p>
<a href="#" class="w4scd-btn">Reserve a loaf</a>
</div>
<ul class="w4scd-list">
<li class="w4scd-card"><article class="w4scd-face" style="--bg:#f7f1e6;--ink:#2b2119;--chip:#e6d9c3">
<div class="w4scd-top"><span>No. 01</span><span class="w4scd-price">$9</span></div>
<h3>Country white</h3>
<p>Long cold proof, blistered crust, a soft open crumb that holds butter.</p>
<div class="w4scd-tags"><span>Bakes daily</span><span>780 g</span></div>
<span class="w4scd-shade" aria-hidden="true"></span>
</article></li>
<li class="w4scd-card"><article class="w4scd-face" style="--bg:#b4532e;--ink:#fff8f0;--chip:#93401f">
<div class="w4scd-top"><span>No. 02</span><span class="w4scd-price">$11</span></div>
<h3>Rye and caraway</h3>
<p>Dense, dark and a little sour. Slice it thin and it keeps for a week.</p>
<div class="w4scd-tags"><span>Thu to Sat</span><span>900 g</span></div>
<span class="w4scd-shade" aria-hidden="true"></span>
</article></li>
<li class="w4scd-card"><article class="w4scd-face" style="--bg:#5f6f4f;--ink:#f6f3ea;--chip:#4b5a3d">
<div class="w4scd-top"><span>No. 03</span><span class="w4scd-price">$10</span></div>
<h3>Seeded spelt</h3>
<p>Toasted sunflower, linseed and pumpkin folded through a spelt dough.</p>
<div class="w4scd-tags"><span>Bakes daily</span><span>750 g</span></div>
<span class="w4scd-shade" aria-hidden="true"></span>
</article></li>
<li class="w4scd-card"><article class="w4scd-face" style="--bg:#2b2420;--ink:#f3ebe0;--chip:#463b33">
<div class="w4scd-top"><span>No. 04</span><span class="w4scd-price">$7</span></div>
<h3>Olive fougasse</h3>
<p>Leaf-cut flatbread with green olives and thyme, best still warm.</p>
<div class="w4scd-tags"><span>Weekends</span><span>Tear and share</span></div>
<span class="w4scd-shade" aria-hidden="true"></span>
</article></li>
</ul>
</div>
</section>
<style>
/* Change these: --w4scd-paper (background), --w4scd-stick (how far from the top cards pin),
and the card colours in each card's style attribute (--bg, --ink, --chip). */
.w4scd-root { --w4scd-paper: #efe7da; --w4scd-stick: 48px; height: 620px; overflow-y: auto; position: relative;
background: var(--w4scd-paper); color: #2b2119; font-family: system-ui, sans-serif; scrollbar-width: thin; scrollbar-color: #c9b89c transparent; }
.w4scd-root:focus-visible { outline: 3px solid #b4532e; outline-offset: -3px; }
.w4scd-hint { position: sticky; top: 0; z-index: 20; height: 0; display: flex; justify-content: center; pointer-events: none; transition: opacity .4s ease; }
.w4scd-hint span { margin-top: 10px; padding: 4px 12px; border-radius: 999px; background: rgba(43,33,25,.82); color: #f7f1e6; font-size: 12px; letter-spacing: .04em; }
.w4scd-root[data-scrolled] .w4scd-hint { opacity: 0; }
.w4scd-wrap { box-sizing: border-box; max-width: 64rem; margin: 0 auto; padding: 48px 20px 96px; display: grid; gap: 32px; }
@media (min-width: 768px) { .w4scd-wrap { grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr); gap: 48px; padding: 48px 40px 96px; }
.w4scd-intro { position: sticky; top: 48px; align-self: start; } }
.w4scd-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #93401f; }
.w4scd-title { margin: 12px 0 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(1.9rem, 3.4vw, 2.25rem); line-height: 1.15; }
.w4scd-lede { margin: 16px 0 0; max-width: 24rem; font-size: 15px; line-height: 1.65; color: #5a4a3b; }
.w4scd-btn { margin-top: 24px; display: inline-flex; align-items: center; min-height: 44px; padding: 0 24px; border-radius: 999px;
background: #2b2119; color: #f7f1e6; font-size: 14px; font-weight: 600; text-decoration: none; }
.w4scd-btn:hover { background: #453629; }
.w4scd-btn:focus-visible { outline: 2px solid #b4532e; outline-offset: 3px; }
.w4scd-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 24px; }
.w4scd-card { position: sticky; top: var(--w4scd-stick); }
.w4scd-face { position: relative; display: flex; flex-direction: column; min-height: 360px; box-sizing: border-box; padding: 28px; border-radius: 28px;
background: var(--bg); color: var(--ink); box-shadow: 0 18px 40px -20px rgba(43,33,25,.45); transform-origin: 50% 0; will-change: transform; }
@media (min-width: 640px) { .w4scd-face { padding: 36px; } }
.w4scd-top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 500; opacity: .9; }
.w4scd-price { font-family: Georgia, serif; font-size: 24px; }
.w4scd-face h3 { margin: auto 0 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(2.25rem, 5vw, 3rem); line-height: 1; }
.w4scd-face p { margin: 16px 0 0; max-width: 28rem; font-size: 15px; line-height: 1.65; opacity: .9; }
.w4scd-tags { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.w4scd-tags span { padding: 4px 12px; border-radius: 999px; background: var(--chip); font-size: 12px; font-weight: 600; }
.w4scd-shade { position: absolute; inset: 0; border-radius: inherit; background: #1a130e; opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .w4scd-face { transform: none !important; } .w4scd-shade { opacity: 0 !important; } .w4scd-hint { display: none; } }
</style>
<script>
(function () {
var root = document.querySelector("[data-w4scd]");
if (!root || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
var SCALE_STEP = 0.06; // how much smaller each covering card makes the ones beneath
var DIM_STEP = 0.24; // how much darker each covering card makes the ones beneath
var AUTO = 28; // demo scroll speed in px per second; 0 turns it off
// The box scrolls itself. For page scroll: drop height and overflow on .w4scd-root and set sc = null.
var sc = root;
var cards = [].slice.call(root.querySelectorAll(".w4scd-card"));
var raf = 0;
function paint() {
raf = 0;
var top = sc ? sc.getBoundingClientRect().top : 0;
var cover = cards.map(function (c) {
var d = c.getBoundingClientRect().top - top - parseFloat(getComputedStyle(c).top);
return Math.min(1, Math.max(0, 1 - d / c.offsetHeight));
});
cards.forEach(function (c, i) {
var depth = 0;
for (var j = i + 1; j < cards.length; j++) depth += cover[j];
c.firstElementChild.style.transform = "scale(" + (1 - SCALE_STEP * depth) + ")";
c.querySelector(".w4scd-shade").style.opacity = Math.min(0.6, DIM_STEP * depth);
});
root.toggleAttribute("data-scrolled", (sc ? sc.scrollTop : scrollY) > 8);
}
(sc || window).addEventListener("scroll", function () { if (!raf) raf = requestAnimationFrame(paint); }, { passive: true });
paint();
if (!sc || !AUTO) return;
// Demo scroll until the visitor takes over; paused while off screen.
var demo = 0, last = 0, pos = sc.scrollTop, seen = true, done = false;
function step(now) {
var dt = last ? Math.min(now - last, 50) : 0;
last = now;
pos += AUTO * dt / 1000;
if (pos >= sc.scrollHeight - sc.clientHeight) { done = true; demo = 0; return; }
sc.scrollTop = pos;
demo = requestAnimationFrame(step);
}
function start() { if (!done && seen && !demo) { last = 0; demo = requestAnimationFrame(step); } }
function stop() { cancelAnimationFrame(demo); demo = 0; }
new IntersectionObserver(function (e) { seen = e[0].isIntersecting; seen ? start() : stop(); }).observe(sc);
["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (ev) {
sc.addEventListener(ev, function () { done = true; stop(); }, { passive: true });
});
start();
})();
</script>
With reduced motion: Cards still pin and overlap as you scroll, but none of them shrink or darken and the demo scroll never starts.
Running cost: One rAF-throttled pass on scroll that writes a transform and an opacity per card; idle when nothing scrolls.
- Raise `SCALE_STEP` for a steeper pile, or `DIM_STEP` for darker buried cards.
- Move the pin line with `--w4scd-stick` (or `top-48px` in `.w4scd-card` for React).
- Recolour each card through its `--bg`, `--ink` and `--chip` values, or the `loaves` array in React.
Testimonial Cards Stacking With Alternating Tilt
Customer notes for a garden design firm land on a deep green panel like letters dropped on a table. Each card swings in at a steeper angle and straightens to a slight lean, left then right, as it pins over the one before. Covered notes shrink and fall into shadow, so the newest quote always reads first.
<section class="w4tst-root" data-w4tst tabindex="0" aria-label="Customer reviews, scrollable">
<div class="w4tst-hint" aria-hidden="true"><span>Scroll inside</span></div>
<div class="w4tst-wrap">
<p class="w4tst-label">Brackenfold Gardens</p>
<h2>Notes from the people whose gardens we planted</h2>
<ul class="w4tst-list">
<li class="w4tst-card"><figure class="w4tst-face">
<svg viewBox="0 0 32 24" aria-hidden="true"><path fill="currentColor" d="M0 24V14C0 6 4 1 12 0l1 4c-4 1-6 4-6 8h6v12H0zm19 0V14c0-8 4-13 12-14l1 4c-4 1-6 4-6 8h6v12H19z"/></svg>
<blockquote>They planted our north bed with ferns and hellebores I would never have picked. Two winters on, it is the part of the garden people ask about.</blockquote>
<figcaption><span class="w4tst-av" style="background:#c9d8b6" aria-hidden="true">IB</span><span><b>Imogen Barlow</b><small>Garden in Hebden Bridge</small></span></figcaption>
<span class="w4tst-shade" aria-hidden="true"></span>
</figure></li>
<li class="w4tst-card"><figure class="w4tst-face">
<svg viewBox="0 0 32 24" aria-hidden="true"><path fill="currentColor" d="M0 24V14C0 6 4 1 12 0l1 4c-4 1-6 4-6 8h6v12H0zm19 0V14c0-8 4-13 12-14l1 4c-4 1-6 4-6 8h6v12H19z"/></svg>
<blockquote>The hedge plan came with a watering note pinned to every whip. Not one plant lost in a dry summer, which I did not think possible on our clay.</blockquote>
<figcaption><span class="w4tst-av" style="background:#e6cfa6" aria-hidden="true">DR</span><span><b>Dev Rathore</b><small>Allotment holder</small></span></figcaption>
<span class="w4tst-shade" aria-hidden="true"></span>
</figure></li>
<li class="w4tst-card"><figure class="w4tst-face">
<svg viewBox="0 0 32 24" aria-hidden="true"><path fill="currentColor" d="M0 24V14C0 6 4 1 12 0l1 4c-4 1-6 4-6 8h6v12H0zm19 0V14c0-8 4-13 12-14l1 4c-4 1-6 4-6 8h6v12H19z"/></svg>
<blockquote>I asked for low upkeep and they listened. The meadow strip gets one cut in September and looks better every year it is left alone.</blockquote>
<figcaption><span class="w4tst-av" style="background:#d9b9a3" aria-hidden="true">RE</span><span><b>Ruth Ellery</b><small>Cottage garden, Malton</small></span></figcaption>
<span class="w4tst-shade" aria-hidden="true"></span>
</figure></li>
<li class="w4tst-card"><figure class="w4tst-face">
<svg viewBox="0 0 32 24" aria-hidden="true"><path fill="currentColor" d="M0 24V14C0 6 4 1 12 0l1 4c-4 1-6 4-6 8h6v12H0zm19 0V14c0-8 4-13 12-14l1 4c-4 1-6 4-6 8h6v12H19z"/></svg>
<blockquote>Clear prices, a day booked and kept, and they swept the path before leaving. Small things, but they are why we called them back.</blockquote>
<figcaption><span class="w4tst-av" style="background:#bcd2cf" aria-hidden="true">TL</span><span><b>Tomas Lindqvist</b><small>Courtyard in York</small></span></figcaption>
<span class="w4tst-shade" aria-hidden="true"></span>
</figure></li>
</ul>
<a href="#" class="w4tst-btn">Book a garden visit</a>
</div>
</section>
<style>
/* Change these: --w4tst-forest (background), --w4tst-card (card paper), --w4tst-stick (pin line),
and TILT_REST / TILT_ARRIVE in the script for how crooked the pile looks. */
.w4tst-root { --w4tst-forest: #1e3a2c; --w4tst-card: #f6f1e4; --w4tst-stick: 56px; height: 620px; overflow-y: auto; overflow-x: hidden; position: relative;
background: var(--w4tst-forest); color: #f4efe3; font-family: system-ui, sans-serif; scrollbar-width: thin; scrollbar-color: #47624f transparent; }
.w4tst-root *, .w4tst-root *::before { box-sizing: border-box; }
.w4tst-root:focus-visible { outline: 3px solid #e6cfa6; outline-offset: -3px; }
.w4tst-hint { position: sticky; top: 0; z-index: 20; height: 0; display: flex; justify-content: center; pointer-events: none; transition: opacity .4s ease; }
.w4tst-hint span { margin-top: 10px; padding: 4px 12px; border-radius: 999px; background: rgba(244,239,227,.92); color: #1e3a2c; font-size: 12px; letter-spacing: .04em; }
.w4tst-root[data-scrolled] .w4tst-hint { opacity: 0; }
.w4tst-wrap { max-width: 42rem; margin: 0 auto; padding: 48px 24px 96px; }
.w4tst-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: #e6cfa6; }
.w4tst-wrap h2 { margin: 12px 0 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(1.875rem, 4vw, 2.25rem); line-height: 1.2; }
.w4tst-list { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 32px; }
.w4tst-card { position: sticky; top: var(--w4tst-stick); }
.w4tst-face { position: relative; margin: 0; padding: 28px; border-radius: 16px; background: var(--w4tst-card); color: #1f2a22;
box-shadow: 0 28px 50px -24px rgba(0,0,0,.6); transform-origin: 50% 40%; will-change: transform; }
.w4tst-card:nth-child(odd) .w4tst-face { transform: rotate(-1.6deg); }
.w4tst-card:nth-child(even) .w4tst-face { transform: rotate(1.6deg); }
.w4tst-face svg { display: block; width: 32px; height: 24px; color: #5b7a52; }
.w4tst-face blockquote { margin: 20px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.25rem, 2.6vw, 1.5rem); line-height: 1.6; }
.w4tst-face figcaption { margin-top: 28px; display: flex; align-items: center; gap: 12px; }
.w4tst-av { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; font-size: 14px; font-weight: 600; }
.w4tst-face b { display: block; }
.w4tst-face small { display: block; font-size: 14px; color: #55604f; }
.w4tst-shade { position: absolute; inset: 0; border-radius: inherit; background: #0c1a12; opacity: 0; pointer-events: none; }
.w4tst-btn { margin-top: 56px; display: inline-flex; align-items: center; min-height: 44px; padding: 0 24px; border-radius: 999px;
background: #e6cfa6; color: #1e3a2c; font-size: 14px; font-weight: 600; text-decoration: none; }
.w4tst-btn:hover { background: #f0dcb8; }
.w4tst-btn:focus-visible { outline: 2px solid #f4efe3; outline-offset: 3px; }
@media (min-width: 640px) { .w4tst-face { padding: 36px; } }
@media (prefers-reduced-motion: reduce) { .w4tst-shade { opacity: 0 !important; } .w4tst-hint { display: none; } }
</style>
<script>
(function () {
var root = document.querySelector("[data-w4tst]");
if (!root || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
var TILT_REST = 1.6; // degrees each card keeps once settled (alternates left and right)
var TILT_ARRIVE = 3.5; // extra tilt while a card is still sliding in
var SCALE_STEP = 0.045; // shrink per card on top
var AUTO = 30; // demo scroll speed in px per second; 0 turns it off
// The box scrolls itself. For page scroll: drop height and overflow on .w4tst-root and set sc = null.
var sc = root;
var cards = [].slice.call(root.querySelectorAll(".w4tst-card"));
var raf = 0;
function paint() {
raf = 0;
var top = sc ? sc.getBoundingClientRect().top : 0;
var cover = cards.map(function (c) {
var d = c.getBoundingClientRect().top - top - parseFloat(getComputedStyle(c).top);
return Math.min(1, Math.max(0, 1 - d / c.offsetHeight));
});
cards.forEach(function (c, i) {
var depth = 0;
for (var j = i + 1; j < cards.length; j++) depth += cover[j];
var turn = (i % 2 ? 1 : -1) * (TILT_REST + TILT_ARRIVE * (1 - cover[i]));
c.firstElementChild.style.transform = "rotate(" + turn + "deg) scale(" + (1 - SCALE_STEP * depth) + ")";
c.querySelector(".w4tst-shade").style.opacity = Math.min(0.5, 0.22 * depth);
});
root.toggleAttribute("data-scrolled", (sc ? sc.scrollTop : scrollY) > 8);
}
(sc || window).addEventListener("scroll", function () { if (!raf) raf = requestAnimationFrame(paint); }, { passive: true });
paint();
if (!sc || !AUTO) return;
var demo = 0, last = 0, pos = sc.scrollTop, seen = true, done = false;
function step(now) {
var dt = last ? Math.min(now - last, 50) : 0;
last = now;
pos += AUTO * dt / 1000;
if (pos >= sc.scrollHeight - sc.clientHeight) { done = true; demo = 0; return; }
sc.scrollTop = pos;
demo = requestAnimationFrame(step);
}
function start() { if (!done && seen && !demo) { last = 0; demo = requestAnimationFrame(step); } }
function stop() { cancelAnimationFrame(demo); demo = 0; }
new IntersectionObserver(function (e) { seen = e[0].isIntersecting; seen ? start() : stop(); }).observe(sc);
["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (ev) {
sc.addEventListener(ev, function () { done = true; stop(); }, { passive: true });
});
start();
})();
</script>
With reduced motion: Cards hold a fixed slight lean, pin in order and never swing, shrink or darken.
Running cost: Per scrolled frame, four cards each get one combined rotate and scale plus one opacity.
- Set `TILT_REST` to 0 for straight cards, or raise `TILT_ARRIVE` for a livelier swing in.
- Swap the quotes, names and avatar tones in the `reviews` array.
- Retheme with `--w4tst-forest` for the panel and `--w4tst-card` for the paper.
Performance notes
Sticky positioning is native and costs nothing per frame. The only animated values are the scale and brightness overlay of covered cards, and both are transform and opacity, so the stack scrolls smoothly on phones too.
Where scroll-driven animations are missing, the fallback script reads each card's position once per frame only while the stack is on screen and writes a single transform per card. It detaches its observer when the section leaves view.
Questions
How do I make cards stack on scroll with CSS?
Put the cards in one container, give each position: sticky and the same top value, and leave enough scroll distance below them. Each card stays pinned while the next scrolls over it. The shrinking and dimming of covered cards is the optional animated part.
Why is my sticky card not sticking?
Usually an ancestor has overflow set to hidden or auto, which makes that element the scroll container, or the card has no top value. Sticky elements also stop sticking at the end of their parent, so the parent must be taller than the stack.
Does the stack work on mobile?
Yes. Sticky positioning works in all current mobile browsers. On small screens the cards here use a smaller top offset and padding so a pinned card never covers more of the screen than it needs.
Is a scroll-stacking section accessible?
The cards stay in normal reading order in the HTML, so screen readers and keyboard users move through them like any list. With reduced motion the scaling stops and the cards simply scroll past in order.
More collections: Scroll Animations Without a Library, Smooth Scroll and Parallax Effects, Expanding Cards and Image Panels. All scroll effects. Build your site free to have a full site built around them.
Product
Who It's For
- For Agencies
- For Freelancers
- For Hosting Providers
- For SaaS Platforms
- For Startups
- For Financial Services
- For Healthcare
Features
Resources
- Blog
- Help Center
- Free Business Tools
- Free UI Components
- Website Templates
- Template Collections
- Website Examples
- Guides
- Comparisons
- Alternatives
- Best Lists
- Reviews
- Pricing Guides
- Use Cases
- Glossary & Guides
- Integrations
- Developers
- Benchmark
- Windows App