Skip to content

3D Flip Card

Three pure CSS 3D flip cards that turn on hover, keyboard focus or tap to reveal details and a link on the back.

Also known as: flip card, card flip on hover, 3d card flip animation, two sided card

3D Flip Card live demo

Open in new tab

Pure CSS code (HTML, CSS, JS)

A set of three 3D flip cards built with pure CSS and a few lines of vanilla JavaScript. Each card shows a bold gradient front with an icon and title, then turns over to reveal details and a call-to-action link. Use it for service overviews, feature highlights, team bios or pricing teasers.

How it works

The root section.fc-deck holds a heading, a short intro and the .fc-grid of article.fc-card elements. Every card wraps an .fc-inner element with two faces: .fc-front (icon, .fc-title, .fc-tagline and a .fc-hint) and .fc-back (text, an .fc-list and an .fc-link). The faces sit in the same grid cell, so the card grows to fit the taller face instead of relying on a fixed height. .fc-card sets perspective, .fc-inner uses transform-style: preserve-3d, and both faces use backface-visibility: hidden, with the back face pre-rotated by 180 degrees.

The flip is driven by one custom property. .fc-inner rotates by calc(var(--fc-flip) * 180deg), and --fc-flip switches from 0 to 1 on mouse hover (only on devices that support hover), on :focus-visible of the card, when the link on the back has keyboard focus (via :has()), and when the card has the .is-flipped class. The script listens for click on each card and toggles .is-flipped only on touch screens ((hover: none)), closing any other open card. Taps on the link are left alone so it navigates normally. Without JavaScript, hover and keyboard focus still work.

Customization

  • .fc-card--violet, .fc-card--teal and .fc-card--amber: each sets --fc-accent and --fc-accent-2, the two gradient stops of the front face and the color of the list bullets. Add your own modifier for a new color.
  • --fc-height on .fc-deck: the minimum card height; raise it for taller cards with more content.
  • --fc-speed: duration of the flip, e.g. 0.4s for a snappier turn.
  • --fc-perspective: lower values such as 600px give a more dramatic 3D effect.
  • --fc-back-bg and --fc-back-text: background and text color of the back face, for example a light back with dark text.
  • --fc-radius: the corner radius of the cards and their focus ring.
  • grid-template-columns in the .fc-grid media queries: the grid shows one column on phones, two from 640px and three from 960px.

Use cases

  • Service overviews: the front shows an icon and title, the back reveals details and a link
  • Feature highlights: cards turn on hover, keyboard focus or tap to show more information
  • Team bios: the back face gives space for text that would clutter the front
  • Pricing teasers: gradient fronts catch attention and the back carries a call-to-action link

Accessibility

Each card has tabindex="0" and aria-labelledby pointing to its title, so keyboard users can Tab to it and see the back. A visible ring is drawn around a focused card with --fc-focus, and the link has its own outline. Both faces stay in the DOM, so screen readers read the full content in order. Decorative icons and the hint text are aria-hidden. With prefers-reduced-motion: reduce the rotation is replaced by a short cross-fade between the faces.

Usage notes

Several decks can share a page; the script scopes each one to its own .fc-deck. The :has() rule needs a current browser; in older ones the card still flips when the card itself is focused.

3D Flip Card at a glance

Framework
Pure CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
None
Layout
Responsive, works on mobile
Category
Cards
License
Free for personal and commercial use

Questions about this template

Can I use the 3D Flip Card code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

There is nothing to install. Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

No dependencies. Pure HTML, CSS and JavaScript.

3D Flip Card – free Pure CSS card template
3D Flip Card · free Pure CSS card template

More Cards

Event Card with Photo and Date Badge – free Pure CSS card template

Event Card with Photo and Date Badge

Pure CSS event cards with a cover photo, ticket-stub date badge, category chip, time and venue details, price and a ticket button.

Cards with Hover Lift – free Pure CSS card template

Cards with Hover Lift

Pure CSS blog card grid where each card lifts with a deeper shadow and zooms its image on hover or keyboard focus.

Blog Post Card – free Tailwind CSS card template

Blog Post Card

Tailwind CSS blog post card with cover illustration, category badge, date, reading time, clamped excerpt, author row and a fully clickable area.

Card with Image Overlay Text – free Bootstrap 6 card template

Card with Image Overlay Text

Dark Bootstrap 6 travel cards with headline, place and price set over full-bleed photos, a gradient scrim for readability, save buttons and a Toast.

Glassmorphism Card – free Tailwind CSS card template

Glassmorphism Card

Frosted glass profile card in Tailwind CSS with backdrop blur, a light reflection and a follow button over colorful animated gradient blobs.

Interactive Card with Hover Lift – free Bootstrap 6 card template

Interactive Card with Hover Lift

Bootstrap 6 clickable learning path cards that lift with a soft shadow on hover and keyboard focus, using hover-lift, stretched links and a level filter.