# 3D Tilt Card

> A card that tilts toward the cursor in 3D using nine invisible hover zones instead of JavaScript.

- Category: [CSS Cards](https://copy-css.com/category/cards)
- Tags: tilt, 3d, perspective, hover, parallax, no javascript
- Live preview: https://copy-css.com/snippets/3d-tilt-card
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="tilt">
  <span></span><span></span><span></span>
  <span></span><span></span><span></span>
  <span></span><span></span><span></span>
  <div class="tilt-card">
    <h3>Tilt me</h3>
    <p>Move your cursor around the card.</p>
  </div>
</div>
```

## CSS

```css
.tilt {
  --tilt: 10deg;
  position: relative;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  width: 230px;
  height: 150px;
  perspective: 700px;
  font-family: system-ui, sans-serif;
}

.tilt > span {
  position: relative;
  z-index: 2;
}

.tilt-card {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: end;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f472b6, #8b5cf6 55%, #3b82f6);
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.6);
  color: #fff;
  transition: transform 0.35s ease;
}

.tilt-card h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.tilt-card p {
  margin: 0;
  font-size: 13px;
  opacity: 0.9;
}

.tilt > span:nth-child(1):hover ~ .tilt-card {
  transform: rotateX(var(--tilt)) rotateY(calc(var(--tilt) * -1));
}

.tilt > span:nth-child(2):hover ~ .tilt-card {
  transform: rotateX(var(--tilt));
}

.tilt > span:nth-child(3):hover ~ .tilt-card {
  transform: rotateX(var(--tilt)) rotateY(var(--tilt));
}

.tilt > span:nth-child(4):hover ~ .tilt-card {
  transform: rotateY(calc(var(--tilt) * -1));
}

.tilt > span:nth-child(5):hover ~ .tilt-card {
  transform: scale(1.03);
}

.tilt > span:nth-child(6):hover ~ .tilt-card {
  transform: rotateY(var(--tilt));
}

.tilt > span:nth-child(7):hover ~ .tilt-card {
  transform: rotateX(calc(var(--tilt) * -1)) rotateY(calc(var(--tilt) * -1));
}

.tilt > span:nth-child(8):hover ~ .tilt-card {
  transform: rotateX(calc(var(--tilt) * -1));
}

.tilt > span:nth-child(9):hover ~ .tilt-card {
  transform: rotateX(calc(var(--tilt) * -1)) rotateY(var(--tilt));
}

@media (prefers-reduced-motion: reduce) {
  .tilt-card {
    transition: none;
  }

  .tilt > span:hover ~ .tilt-card {
    transform: none;
  }
}
```

## Notes

- This CSS 3D Tilt Card is 85 lines of pure CSS (1.7 KB) with no JavaScript and no dependencies. It uses transitions, 3D transforms, transforms and linear gradients.
- Customize with: `--tilt`.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
