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

~/css/tailwind-tilt-cards

6 Tailwind Tilt Cards

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

Six 3D tilt cards built with Tailwind utilities: a card that leans back on hover, one that follows the pointer, a pass with a moving glare, layered depth with translateZ, a link card that tilts on keyboard focus too and a grid of swinging tiles.

01. Tailwind Hover Tilt Card

TailwindTilt

A card that leans back in 3D on hover using only utilities: a perspective on the wrapper from an arbitrary property and a rotateX/rotateY transform on hover. The motion-safe: prefix means it never tilts for people who prefer reduced motion.

View code
<div class="[perspective:800px]">
  <article class="w-64 max-w-full rounded-2xl bg-gradient-to-br from-indigo-600 to-violet-800 p-6 text-white shadow-xl transition duration-300 motion-safe:hover:[transform:rotateX(8deg)_rotateY(-12deg)] hover:shadow-2xl">
    <p class="text-xs font-semibold uppercase tracking-widest text-indigo-200">Pro plan</p>
    <h3 class="mt-2 text-2xl font-bold">$24 / month</h3>
    <p class="mt-2 text-sm text-indigo-100">Unlimited projects, priority support and team seats.</p>
  </article>
</div>

02. Tailwind Pointer-Follow Tilt

TailwindTiltJS

The card leans towards the pointer. A few lines of JavaScript write two custom properties and one arbitrary transform utility reads them, so all the styling stays in Tailwind classes. The script does nothing when reduced motion is requested.

View code
<div class="[perspective:900px]">
  <div data-tilt class="w-64 max-w-full rounded-2xl bg-slate-900 p-6 text-slate-100 shadow-2xl ring-1 ring-white/10 transition-transform duration-150 ease-out [transform:rotateX(var(--rx,0deg))_rotateY(var(--ry,0deg))]">
    <p class="text-xs font-semibold uppercase tracking-widest text-cyan-300">Move your pointer</p>
    <h3 class="mt-2 text-xl font-bold">Follows the cursor</h3>
    <p class="mt-1 text-sm text-slate-300">The card leans towards the pointer and settles back when it leaves.</p>
  </div>
</div>
var c = document.querySelector('[data-tilt]');
if (!matchMedia('(prefers-reduced-motion: reduce)').matches) {
  c.addEventListener('pointermove', function (e) { var r = c.getBoundingClientRect(), x = (e.clientX - r.left) / r.width - .5, y = (e.clientY - r.top) / r.height - .5; c.style.setProperty('--ry', x * 16 + 'deg'); c.style.setProperty('--rx', -y * 16 + 'deg'); });
  c.addEventListener('pointerleave', function () { c.style.setProperty('--rx', '0deg'); c.style.setProperty('--ry', '0deg'); });
}

03. Tailwind Tilt Card with Glare

TailwindTiltGlare

A pass-style card that tilts with the pointer while a soft highlight follows it across the surface. The glare is an aria-hidden span with a radial gradient positioned by custom properties, faded in with group-hover:opacity-100.

View code
<div class="[perspective:900px]">
  <div data-glare class="group relative w-64 max-w-full overflow-hidden rounded-2xl bg-gradient-to-br from-rose-700 via-fuchsia-700 to-indigo-800 p-6 text-white shadow-2xl transition-transform duration-150 [transform:rotateX(var(--rx,0deg))_rotateY(var(--ry,0deg))]">
    <span aria-hidden="true" class="pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-200 group-hover:opacity-100 [background:radial-gradient(circle_at_var(--gx,50%)_var(--gy,50%),rgba(255,255,255,.4),transparent_55%)]"></span>
    <p class="relative text-xs font-semibold uppercase tracking-widest text-pink-100">Member pass</p>
    <h3 class="relative mt-6 text-2xl font-black">Gold access</h3>
    <p class="relative text-sm text-pink-100">Valid until 31 December</p>
  </div>
</div>
var g = document.querySelector('[data-glare]'), still = matchMedia('(prefers-reduced-motion: reduce)').matches;
g.addEventListener('pointermove', function (e) { var r = g.getBoundingClientRect(), x = (e.clientX - r.left) / r.width, y = (e.clientY - r.top) / r.height; g.style.setProperty('--gx', x * 100 + '%'); g.style.setProperty('--gy', y * 100 + '%'); if (!still) { g.style.setProperty('--ry', (x - .5) * 14 + 'deg'); g.style.setProperty('--rx', (.5 - y) * 14 + 'deg'); } });
g.addEventListener('pointerleave', function () { g.style.setProperty('--rx', '0deg'); g.style.setProperty('--ry', '0deg'); });

04. Tailwind 3D Layered Tilt

TailwindTiltDepth

Layers inside the card sit at different depths with translateZ, and transform-style: preserve-3d keeps them in 3D space, so tilting on hover reveals a parallax between them. All of it is arbitrary property utilities.

View code
<div class="group [perspective:900px]">
  <div class="relative h-52 w-60 max-w-full rounded-2xl bg-slate-900 shadow-2xl transition-transform duration-500 [transform-style:preserve-3d] motion-safe:group-hover:[transform:rotateY(-18deg)_rotateX(10deg)]">
    <div class="absolute inset-4 rounded-xl bg-gradient-to-br from-sky-500 to-indigo-700 [transform:translateZ(20px)]"></div>
    <div aria-hidden="true" class="absolute right-8 top-8 size-12 rounded-full bg-amber-300 shadow-lg [transform:translateZ(80px)]"></div>
    <p class="absolute bottom-8 left-8 rounded-lg bg-white px-3 py-2 text-sm font-bold text-slate-900 shadow-lg [transform:translateZ(55px)]">Depth layers</p>
  </div>
</div>

06. Tailwind Tilting Tile Grid

TailwindTiltGrid

A row of category tiles that each swing on their vertical axis when hovered, sharing one perspective set on the grid. odd: and even: variants turn neighbouring tiles in opposite directions for a playful feel.

View code
<ul class="grid w-72 max-w-full grid-cols-3 gap-3 [perspective:600px]">
  <li class="grid aspect-square place-items-center content-center gap-1 rounded-xl bg-emerald-700 text-white shadow transition duration-300 motion-safe:odd:hover:[transform:rotateY(25deg)] motion-safe:even:hover:[transform:rotateY(-25deg)]"><span aria-hidden="true" class="text-2xl">🌿</span><span class="text-xs font-semibold">Plants</span></li>
  <li class="grid aspect-square place-items-center content-center gap-1 rounded-xl bg-sky-700 text-white shadow transition duration-300 motion-safe:odd:hover:[transform:rotateY(25deg)] motion-safe:even:hover:[transform:rotateY(-25deg)]"><span aria-hidden="true" class="text-2xl">🛋️</span><span class="text-xs font-semibold">Living</span></li>
  <li class="grid aspect-square place-items-center content-center gap-1 rounded-xl bg-rose-700 text-white shadow transition duration-300 motion-safe:odd:hover:[transform:rotateY(25deg)] motion-safe:even:hover:[transform:rotateY(-25deg)]"><span aria-hidden="true" class="text-2xl">🍳</span><span class="text-xs font-semibold">Kitchen</span></li>
</ul>

About these Tailwind Tilt Cards

Perspective on the parent

Tailwind has no perspective utility in v3, so use the arbitrary property [perspective:800px] on the wrapper. Lower values give a stronger 3D effect.

Transforms as arbitrary values

hover:[transform:rotateX(8deg)_rotateY(-12deg)] writes the whole transform; underscores stand in for spaces inside arbitrary values.

Pointer tilt with custom properties

A short script writes --rx and --ry on pointer move, and one utility reads them. The styling stays in classes and the script stays tiny.

Respect reduced motion

Prefix hover transforms with motion-safe: and skip the pointer script when prefers-reduced-motion is set. Keep the hover shadow so there is still feedback.

Frequently asked questions

Do tilt cards work on phones?

Touch screens have no hover, so the cards simply stay flat, which is fine.

Which Tailwind version is used?

Tailwind CSS v3 through the Play CDN; the classes work the same in a compiled v3 project.

Is there a CSS version?

Yes, see the CSS tilt cards collection.