StealThis .dev

Stack Cards

Overlapping card stack UI — hover fans out the cards, click rotates through them. Used for layered content previews.

Open in Lab
css
Targets: HTML

Code

Stack Cards

Layered card deck with hover fan-out and click-to-cycle interactions.

Behavior

  • Default — cards stack with slight vertical offset and scale reduction per layer
  • Hover — cards fan out using rotate transforms, revealing all cards in the stack
  • Click — the bottom card moves to the top with a flip animation

Implementation

Pure CSS for the stack and fan-out; a single data-active index on the wrapper handles click cycling via CSS sibling combinators. No JavaScript required for the hover fan — only a minimal <script> is included for the click-to-cycle behavior to update the wrapper class.