# Fan-out Card Stack

> A neat stack of cards that fans out like a hand of cards when you hover it.

- Category: [CSS Cards](https://copy-css.com/category/cards)
- Tags: stack, deck, fan, hover, photos, rotate
- Live preview: https://copy-css.com/snippets/fan-out-cards
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="fan" tabindex="0" role="group" aria-label="Photo stack">
  <div></div>
  <div></div>
  <div></div>
</div>
```

## CSS

```css
.fan {
  position: relative;
  width: 120px;
  height: 150px;
}

/* Set each card's background-image to a photo */
.fan > * {
  position: absolute;
  inset: 0;
  border: 4px solid #fff;
  border-radius: 14px;
  background: #e7e5e4 center / cover;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.45);
  transform-origin: 50% 100%;
  transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.fan > :nth-child(1) { transform: rotate(-4deg); }
.fan > :nth-child(3) { transform: rotate(4deg); }

.fan:hover > :nth-child(1),
.fan:focus-visible > :nth-child(1) {
  transform: translateX(-18px) rotate(-12deg);
}

.fan:hover > :nth-child(2),
.fan:focus-visible > :nth-child(2) {
  transform: translateY(-8px);
}

.fan:hover > :nth-child(3),
.fan:focus-visible > :nth-child(3) {
  transform: translateX(18px) rotate(12deg);
}

.fan:focus-visible {
  outline: none;
}
```

## Notes

- This CSS Fan-out Card Stack is 39 lines of pure CSS (0.8 KB) with no JavaScript and no dependencies. It uses transitions, transforms, box shadows and keyboard focus styles.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
