Skip to content

3D tilt card on hover

Each card pivots in perspective towards the hovered area, with a glare and a cast shadow that follow the mouse.

  • Tailwind
  • React
  • CSS
  • WordPress
Open in a new tab

Description

Three pottery class cards, each with a title, price and booking link. When the mouse hovers, the card dips slightly on the pointed side, a light glare glides under the cursor and its cast shadow stretches the opposite way, like an object tilted towards the light. About thirty lines of dependency-free JavaScript, limited to one update per frame, only set two CSS variables per card (--efci-tx and --efci-ty, from -1 to 1); tilt, glare and shadow move with transform and opacity. Without JavaScript, the :hover pseudo-class alone gives an equally polished fixed tilt, and keyboard focus on the link produces the same effect with a clear outline. Nothing moves for touch or pen input, nor with prefers-reduced-motion: the cards stay flat with a fixed shadow. The text is real HTML, with AA contrast over the glare in light and dark themes, and no horizontal scrolling from 360 px. Angle (--efci-tilt), perspective depth (--efci-depth), radius, glare and shadow colours are set through CSS variables prefixed efci.

Code

Loading the code…

The code of this component in

Archive contents

effet-carte-inclinaison-3d-html-tailwind.zip3 files · 6 Ko

  • index.html10 Ko
  • README.md4 Ko
  • LICENSE.md1 Ko

Tags

Updated on December 2, 2026.

Reviews

No reviews yet.

In the same spirit

  • Cards that fade in as they enter the screen, one after another in each row, without a line of JavaScript and with a static fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A translucent card with a saturated blur whose sharper edge refracts the colourful shapes drifting behind it, with an opaque fallback when transparency is reduced.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A help block shaped like a conversation: bubbles, three animated typing dots and clickable quick replies that show your answers to frequent questions, frozen under prefers-reduced-motion.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component