Weekend in Lisbon
Three days of tiles, tarts and trams.
The card turns over to show its back. Front and back are stacked faces with backface-visibility hidden inside a 3D-preserving wrapper, so both sides render crisply.
Also known as: 3D flip card, front back card hover, card rotate.
Hover to flip
Figma, tokens, motion.
<div class="hfx-card-flip">
<div class="hfx-card-flip-inner">
<div class="hfx-card-flip-front"><h3>Design</h3><p>Hover to flip</p></div>
<div class="hfx-card-flip-back"><h3>Details</h3><p>Figma, tokens, motion.</p></div>
</div>
</div>.hfx-card-flip {
--c: var(--hfx-color, #3b82f6);
font-size: var(--hfx-size, 16px);
width: 12em;
height: 8em;
perspective: 40em;
font-family: system-ui, sans-serif;
}
.hfx-card-flip-inner {
position: relative;
width: 100%;
height: 100%;
transform-style: preserve-3d;
transition: transform 0.6s ease;
}
.hfx-card-flip:hover .hfx-card-flip-inner { transform: rotateY(180deg); }
.hfx-card-flip-front,
.hfx-card-flip-back {
position: absolute;
inset: 0;
display: grid;
place-content: center;
text-align: center;
border-radius: 0.75em;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
}
.hfx-card-flip-front {
background: color-mix(in srgb, var(--c) 12%, transparent);
border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
color: var(--c);
}
.hfx-card-flip-back {
background: var(--c);
color: #fff;
transform: rotateY(180deg);
}
.hfx-card-flip h3 { margin: 0 0 0.2em; font-size: 1.1em; }
.hfx-card-flip p { margin: 0; font-size: 0.85em; opacity: 0.85; }
@media (prefers-reduced-motion: reduce) {
.hfx-card-flip, .hfx-card-flip *, .hfx-card-flip::before, .hfx-card-flip::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--hfx-color on the element or a parent.
Currently previewing #3b82f6.--hfx-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 16px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.