Skip to content

Card De-Stack

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

Scroll-DrivenHTMLCSSany framework

Scroll ↓

Alpha
Beta
Gamma

Copy into your project

HTML
<!-- Overlapping deck fans apart as it scrolls into view -->
<div class="nuda-sd2-destack__deck">
  <div class="nuda-sd2-destack__card nuda-sd2-destack__card--1">Alpha</div>
  <div class="nuda-sd2-destack__card nuda-sd2-destack__card--2">Beta</div>
  <div class="nuda-sd2-destack__card nuda-sd2-destack__card--3">Gamma</div>
</div>
CSS
.nuda-sd2-destack {
  height: 160px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: #09090b;
  padding: .9rem;
}

.nuda-sd2-destack__hint {
  margin: 0 0 .6rem;
  color: #52525b;
  font-size: .68rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.nuda-sd2-destack__deck {
  display: flex;
  flex-direction: column;
  padding: 0 1.4rem;
}

.nuda-sd2-destack__card {
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 700;
  font-size: .8rem;
  color: #0a0a0a;
  background: #e4ff54;
  box-shadow: 0 6px 16px rgba(0,0,0,.4);
}

.nuda-sd2-destack__card--2 {
  background: #c7e34a;
  margin-top: -38px;
  transform: translateY(0) rotate(-6deg);
  animation: nuda-sd2-destack-b linear both;
  animation-timeline: view(block);
  animation-range: entry 0% cover 45%;
}

.nuda-sd2-destack__card--3 {
  background: #a9c23e;
  margin-top: -38px;
  transform: translateY(0) rotate(6deg);
  animation: nuda-sd2-destack-c linear both;
  animation-timeline: view(block);
  animation-range: entry 0% cover 45%;
}

.nuda-sd2-destack__filler {
  height: 70px;
}

@keyframes nuda-sd2-destack-b {
  to {
    transform: translateY(50px) rotate(0deg);
  }
}

@keyframes nuda-sd2-destack-c {
  to {
    transform: translateY(100px) rotate(0deg);
  }
}

@supports not (animation-timeline:view()) {
  .nuda-sd2-destack__card--2 {
    transform: translateY(50px) rotate(0deg);
  }
  .nuda-sd2-destack__card--3 {
    transform: translateY(100px) rotate(0deg);
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-sd2-destack__card--2 {
    animation: none;
    animation-timeline: none;
    transform: translateY(50px) rotate(0deg);
  }
  .nuda-sd2-destack__card--3 {
    animation: none;
    animation-timeline: none;
    transform: translateY(100px) rotate(0deg);
  }
}

How to use Card De-Stack

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