Create a 3D card flip animation with pure CSS, on hover or on click. Adjust perspective, speed & direction, then copy the code.
Hover over the card to see the 3D flip animation. Adjust perspective depth, speed, and flip direction, then copy the CSS.
Your code is ready
Copy the generated HTML, CSS & JS to your project
The perspective property on the flip card container defines how far the viewer is from the 3D plane. Lower values (300–500px) create dramatic, exaggerated 3D card rotations. Higher values (1000–2000px) make the flip animation look flatter and more subtle. Around 800px is a natural sweet spot for most card flip effects.
rotateY(-180deg) flips the card horizontally, the classic card flip CSS effect. rotateX(-180deg) flips it vertically (like a calendar). The negative value determines the flip direction; positive values rotate the 3D card the other way.
Without backface-visibility: hidden, both sides of the flip card are visible at all times; the back shows through as a mirrored image. Setting it to hidden makes each face invisible when rotated past 90 degrees, creating the clean card flip animation effect.
Applied to the inner wrapper, transform-style: preserve-3d tells the browser that child elements should be positioned in 3D space rather than flattened into a 2D plane. Without this, both faces of the 3D flip card collapse into the same plane and the card flip animation breaks. Supported in all modern browsers.
A simple ease or cubic-bezier(.4,0,.2,1) on the transition gives the flip card animation a natural acceleration/deceleration curve. The 3D card speeds up as it starts rotating and slows down as it lands, creating a satisfying flip card effect.
By default the card rotates around its center axis. Changing transform-origin: center right (or left) shifts the pivot point to the edge of the card, so it opens like a book page rather than spinning in place. Combined with translateX(-100%), this creates a slide-flip where the card physically moves as it turns. For a full demo and code — including a WebGL version with realistic paper curl — see the Page Flip Effect page.
The CSS card flip above works for hover or click on individual elements. With fullPage.js, you get 3D flip and rotation effects between fullscreen sections on scroll, with touch support, keyboard navigation, and snap scrolling built in.
The Effects extension offers CSS-transform-based 3D rotations like cube, innerCube, and door. For a realistic page curl, the Cinematic extension includes a page effect rendered with WebGL. See the Page Flip Effect page for a full demo.
Scroll inside the preview to see a 3D cube rotation transition:
Scroll inside the preview to see the 3D cube transition between sections
Most card flip bugs come down to a handful of CSS rules that silently break 3D context. Here are the most common ones.
You're missing backface-visibility: hidden on one or both faces — or Safari is ignoring it. Always add the -webkit- prefix:
.flip-card-front,
.flip-card-back {
backface-visibility: hidden;
-webkit-backface-visibility: hidden; /* required for Safari */
}
transform-style: preserve-3d only applies one level deep. Any ancestor with overflow: hidden, opacity (less than 1), filter, will-change: transform, or transform on it will flatten the 3D context entirely. Check every parent element between your card and the page root.
/* These all silently kill preserve-3d on children: */
.parent { overflow: hidden; } /* flattens 3D */
.parent { opacity: 0.99; } /* flattens 3D */
.parent { filter: blur(0px); } /* flattens 3D */
.parent { will-change: transform; } /* flattens 3D */
The :hover selector doesn't work on touch devices and can't be toggled programmatically. For card flip on click, toggle a class with JavaScript instead:
/* CSS */
.flip-card.flipped .flip-card-inner {
transform: rotateY(-180deg);
}
// JS
document.querySelector('.flip-card').addEventListener('click', function () {
this.classList.toggle('flipped');
});
The back face needs a pre-applied rotateY(180deg) so it starts facing away. Without it both faces point the same direction and the back is never visible. The sign of the hover transform controls the flip direction — -180deg goes right-to-left, +180deg goes left-to-right.
perspective must sit on the parent of the element being transformed, not on the element itself. Setting it on .flip-card-inner has no effect on its own 3D rotation. Set it on .flip-card (the container).
Flip cards reveal product details, pricing, or specs on the back, keeping things compact and interactive. A classic card flip CSS pattern.
Show a photo on the front and biography on the back. The 3D flip card interaction adds engagement to about pages.
Card flip on click to reveal answers, perfect for educational apps, language learning, and interactive quizzes.
3D card transitions between fullscreen sections give portfolios a presentation feel using rotate 3D card effects.
perspective on the container, transform-style: preserve-3d on the inner wrapper, and backface-visibility: hidden on both faces. On hover, apply rotateY(-180deg) to the inner wrapper. The back face needs an initial rotateY(180deg) so it appears when the 3D flip card rotates. See the interactive demo above.
:hover selector, add a JavaScript click event listener that toggles a class (e.g. flipped) on the card. Then use .flip-card.flipped .flip-card-inner { transform: rotateY(-180deg); } in your CSS. This gives you a card flip on click with a simple class toggle, no animation library needed.
perspective value proportionally: lower values create more dramatic 3D depth, higher values flatten the effect. Use media queries to resize the flip card and perspective for mobile screens.
cube, innerCube, door), or the Cinematic extension for realistic WebGL page curl effects (pageCurlTop, pageCurlBottom).
Add scroll transitions, parallax and animations to your site with fullPage.js. One component, 80+ effects.
Powering fullscreen design for Google, Sony, BBC, eBay & more