SolutionsCase StudiesAI ToolsResourcesAboutContact
Get Your Free AI Automation Audit Book a Free 30-Minute Strategy Call
Playground~/frontend Open editor

~/css/tailwind-stacked-cards

6 Tailwind Stacked Cards

4 Tailwind2 with JSPublished 2026-10-05Free · no sign-up

Six stacking patterns in Tailwind: a card pile that fans out on hover, notifications that collapse into a stack, a deck that cycles with a Next button, cards that pile up as you scroll, a stack of folders and overlapping avatars.

01. Tailwind Fanning Card Pile

TailwindStackHover

A collection card with two coloured cards peeking out behind it at angles. On hover the back cards fan out sideways with group-hover translate and rotate utilities, hinting that there is more inside.

View code
<div class="group relative h-52 w-48">
  <div aria-hidden="true" class="absolute inset-0 rotate-6 rounded-2xl bg-amber-300 shadow-lg transition duration-300 motion-safe:group-hover:translate-x-6 motion-safe:group-hover:rotate-12"></div>
  <div aria-hidden="true" class="absolute inset-0 -rotate-3 rounded-2xl bg-sky-400 shadow-lg transition duration-300 motion-safe:group-hover:-translate-x-6 motion-safe:group-hover:-rotate-12"></div>
  <article class="absolute inset-0 grid content-end rounded-2xl bg-white p-5 shadow-xl">
    <p class="text-xs font-bold uppercase tracking-wider text-slate-500">Collection</p>
    <h3 class="text-xl font-bold text-slate-900">Summer reads</h3>
    <p class="text-sm text-slate-600">12 books</p>
  </article>
</div>

02. Tailwind Expandable Notification Stack

TailwindStackNotifications

Notifications collapse into a neat stack with only the edges of older ones showing, then spread into a list when expanded. A data attribute drives group-data-[open] utilities, and collapsed cards are made inert so they cannot be reached until shown.

View code
<div class="w-full max-w-xs">
  <button id="twsk2b" type="button" aria-expanded="false" aria-controls="twsk2l" class="mb-3 text-sm font-semibold text-indigo-700 hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo-600">Show all 3 notifications</button>
  <ul id="twsk2l" class="group grid">
    <li class="relative z-30 h-16 rounded-xl bg-white p-3 shadow-md"><p class="text-sm font-semibold text-slate-900">Order shipped</p><p class="text-xs text-slate-600">2 minutes ago</p></li>
    <li class="relative z-20 -mt-14 h-16 scale-95 rounded-xl bg-white p-3 shadow-md transition-all duration-300 group-data-[open]:mt-2 group-data-[open]:scale-100 motion-reduce:transition-none"><p class="text-sm font-semibold text-slate-900">New review on Canvas tote</p><p class="text-xs text-slate-600">1 hour ago</p></li>
    <li class="relative z-10 -mt-14 h-16 scale-90 rounded-xl bg-white p-3 shadow-md transition-all duration-300 group-data-[open]:mt-2 group-data-[open]:scale-100 motion-reduce:transition-none"><p class="text-sm font-semibold text-slate-900">Weekly report is ready</p><p class="text-xs text-slate-600">Yesterday</p></li>
  </ul>
</div>
var b = document.getElementById('twsk2b'), l = document.getElementById('twsk2l'), rest = [].slice.call(l.children, 1);
function set(open) { b.setAttribute('aria-expanded', open); b.textContent = open ? 'Show less' : 'Show all 3 notifications'; if (open) l.dataset.open = ''; else delete l.dataset.open; rest.forEach(function (li) { li.inert = !open; }); }
b.onclick = function () { set(b.getAttribute('aria-expanded') !== 'true'); };
set(false);

03. Tailwind Card Deck with Next Button

TailwindStackJS

A deck of destination cards where Next sends the top card to the back and the rest move forward. Each card's offset and scale come from its position in the list, only the top card is reachable, and a status line announces the new card.

View code
<div class="w-full max-w-[260px]">
  <ol id="twsk3" class="relative h-44">
    <li class="absolute inset-0 grid content-end rounded-2xl bg-gradient-to-br from-rose-700 to-orange-700 p-5 text-white shadow-xl transition duration-300 motion-reduce:transition-none"><h3 class="text-xl font-bold">Lisbon</h3><p class="text-sm text-rose-50">Tiles, trams and custard tarts</p></li>
    <li class="absolute inset-0 grid content-end rounded-2xl bg-gradient-to-br from-sky-700 to-indigo-700 p-5 text-white shadow-xl transition duration-300 motion-reduce:transition-none"><h3 class="text-xl font-bold">Tromsø</h3><p class="text-sm text-sky-50">Northern lights from October</p></li>
    <li class="absolute inset-0 grid content-end rounded-2xl bg-gradient-to-br from-emerald-700 to-teal-800 p-5 text-white shadow-xl transition duration-300 motion-reduce:transition-none"><h3 class="text-xl font-bold">Kyoto</h3><p class="text-sm text-emerald-50">Temples and quiet gardens</p></li>
    <li class="absolute inset-0 grid content-end rounded-2xl bg-gradient-to-br from-violet-700 to-fuchsia-700 p-5 text-white shadow-xl transition duration-300 motion-reduce:transition-none"><h3 class="text-xl font-bold">Oaxaca</h3><p class="text-sm text-violet-50">Markets, mezcal and mole</p></li>
  </ol>
  <div class="mt-8 flex items-center justify-between">
    <p id="twsk3s" role="status" class="text-sm text-slate-600">Lisbon</p>
    <button id="twsk3n" type="button" class="rounded-lg bg-slate-900 px-4 py-2 text-sm font-semibold text-white hover:bg-slate-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-slate-900">Next card</button>
  </div>
</div>
var list = document.getElementById('twsk3'), s = document.getElementById('twsk3s');
function lay() { [].forEach.call(list.children, function (c, i) { c.style.transform = 'translateY(' + i * 12 + 'px) scale(' + (1 - i * .06) + ')'; c.style.zIndex = 10 - i; c.style.opacity = i > 2 ? 0 : 1; c.inert = i > 0; }); }
document.getElementById('twsk3n').onclick = function () { list.appendChild(list.firstElementChild); lay(); s.textContent = list.firstElementChild.querySelector('h3').textContent; };
lay();

04. Tailwind Sticky Stacking Cards

TailwindStackSticky

Cards that pile up as you scroll: each one is sticky with a slightly larger top offset, so it stops just below the previous card. The scroll area is a labelled region that can take keyboard focus, so it can be scrolled without a mouse.

View code
<div role="region" aria-label="Launch plan" tabindex="0" class="h-64 w-full max-w-xs overflow-y-auto rounded-2xl bg-slate-200 p-3 focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo-600">
  <ol class="grid gap-20 pb-28">
    <li class="sticky top-0 rounded-xl bg-indigo-800 p-5 text-white shadow-lg"><p class="text-xs font-bold text-indigo-200">Step 1</p><h3 class="text-lg font-bold">Pick a theme</h3></li>
    <li class="sticky top-3 rounded-xl bg-violet-800 p-5 text-white shadow-lg"><p class="text-xs font-bold text-violet-200">Step 2</p><h3 class="text-lg font-bold">Add products</h3></li>
    <li class="sticky top-6 rounded-xl bg-fuchsia-800 p-5 text-white shadow-lg"><p class="text-xs font-bold text-fuchsia-200">Step 3</p><h3 class="text-lg font-bold">Set up payments</h3></li>
    <li class="sticky top-9 rounded-xl bg-rose-800 p-5 text-white shadow-lg"><p class="text-xs font-bold text-rose-200">Step 4</p><h3 class="text-lg font-bold">Launch</h3></li>
  </ol>
</div>

05. Tailwind Folder Stack

TailwindStackFolders

Three folders stacked one in front of the other, each with a tab at a different position so all the labels stay visible. Only absolute positioning and inset utilities are needed; the front folder holds the details.

View code
<div class="relative mt-6 h-52 w-full max-w-xs">
  <div aria-hidden="true" class="absolute inset-x-6 top-0 h-40 rounded-xl rounded-tl-none bg-teal-200"><span class="absolute -top-6 left-0 rounded-t-lg bg-teal-200 px-3 py-1 text-xs font-bold text-teal-900">2024</span></div>
  <div aria-hidden="true" class="absolute inset-x-3 top-8 h-40 rounded-xl bg-teal-400"><span class="absolute -top-6 left-16 rounded-t-lg bg-teal-400 px-3 py-1 text-xs font-bold text-teal-950">2025</span></div>
  <section class="absolute inset-x-0 top-16 h-36 rounded-xl bg-teal-800 p-4 text-white shadow-lg">
    <span class="absolute -top-6 left-32 rounded-t-lg bg-teal-800 px-3 py-1 text-xs font-bold">2026</span>
    <h3 class="text-lg font-bold">Invoices 2026</h3>
    <p class="text-sm text-teal-100">38 files · updated today</p>
  </section>
</div>

06. Tailwind Stacked Avatar Group

TailwindStackAvatars

Overlapping avatar circles with negative space-x and a white ring separating them, ending in a +5 counter. Hovering an avatar lifts it above its neighbours, and the sentence beside the group gives the total in words.

View code
<div class="flex items-center gap-3">
  <ul aria-label="Editors" class="flex -space-x-3">
    <li class="relative grid size-11 place-items-center rounded-full bg-rose-600 text-sm font-bold text-white ring-4 ring-white transition hover:z-10 hover:-translate-y-1">AK</li>
    <li class="relative grid size-11 place-items-center rounded-full bg-sky-700 text-sm font-bold text-white ring-4 ring-white transition hover:z-10 hover:-translate-y-1">JM</li>
    <li class="relative grid size-11 place-items-center rounded-full bg-amber-700 text-sm font-bold text-white ring-4 ring-white transition hover:z-10 hover:-translate-y-1">LT</li>
    <li class="relative grid size-11 place-items-center rounded-full bg-emerald-700 text-sm font-bold text-white ring-4 ring-white transition hover:z-10 hover:-translate-y-1">SR</li>
    <li class="relative grid size-11 place-items-center rounded-full bg-slate-200 text-sm font-bold text-slate-700 ring-4 ring-white">+5</li>
  </ul>
  <p class="text-sm text-slate-700"><b class="text-slate-900">9 people</b> editing</p>
</div>

About these Tailwind Stacked Cards

Stack with absolute or negative margins

Absolutely positioned cards with inset-0 sit exactly on top of each other; negative top margins such as -mt-14 leave a sliver of each card showing.

Depth from scale and z-index

Cards further back get a smaller scale and a lower z-index, which reads as distance without any 3D transforms.

Hidden cards should be unreachable

When a card is covered, set inert on it so keyboard and screen reader users do not land on content they cannot see.

Sticky stacking

Give each card sticky and a growing top- offset inside a scroll container, and they pile up as the list scrolls.

Frequently asked questions

Which demos need JavaScript?

The notification stack and the card deck; the others are CSS only.

Will sticky stacking work on the whole page?

Yes, remove the fixed height and overflow from the wrapper.

Is there a CSS version?

Yes, see the CSS stacked cards collection.