Live preview · fully interactive
The prompt
Build a stack of cards that fans on hover. ## Look Three sheets, width min(280px, 100% - 32px), height 160px, radius 16px, border 1px #23232e. Front #16161f, rear sheets #1b1630 and #12121a. Page #08080d. ## Behavior On hover, rotate the first rear sheet -8deg and translate(-16px, -12px). Rotate the second 7deg and translate(18px, -8px). ## Design tokens - Borders #23232e; sheets #16161f, #1b1630, #12121a; page #08080d. ## Motion - Transition 0.45s, easing cubic-bezier(0.16, 1, 0.3, 1). ## Constraints - Single self-contained HTML file. No libraries. CSS only. - Honor prefers-reduced-motion: reduce by skipping the loop and leaving a readable static frame - Readable at 390px width with no horizontal page scroll
The code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }
body {
background: #08080d; color: #f2f2f7; font-family: Inter, system-ui, sans-serif;
min-height: 100vh; overflow: hidden;
}
.hint { position: absolute; left: 16px; top: 16px; z-index: 5; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #8a8a99; }
main { min-height: 100vh; display: grid; place-items: center; } .stack { position: relative; width: min(280px, calc(100% - 32px)); height: 160px; } .sheet { position: absolute; inset: 0; border-radius: 16px; border: 1px solid #23232e; background: #16161f; transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1); display: grid; place-items: center; } .a { background: #1b1630; } .b { background: #12121a; } .stack:hover .a { transform: rotate(-8deg) translate(-16px, -12px); } .stack:hover .b { transform: rotate(7deg) translate(18px, -8px); }
@media (max-width: 420px) {
.hint { font-size: 10px; letter-spacing: 0.08em; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
</style>
</head>
<body>
<main><div class="stack"><div class="sheet a"></div><div class="sheet b"></div><div class="sheet">Open the stack</div></div></main>
<script>
</script>
</body>
</html>About this effect
Two rear sheets rotate and translate out from under the front card over 0.45s on hover, like a hand of notes.