Weekend in Lisbon
Three days of tiles, tarts and trams.
The whole card lifts and its shadow deepens, the standard hover for anything clickable in a grid. Two properties transition; nothing inside the card moves.
Also known as: card hover shadow, elevated card, floating card.
Three days of tiles, tarts and trams.
<article class="hfx-card-lift">
<div class="hfx-card-lift-image"></div>
<div class="hfx-card-lift-body">
<h3>Weekend in Lisbon</h3>
<p>Three days of tiles, tarts and trams.</p>
</div>
</article>.hfx-card-lift {
--c: var(--hfx-color, #3b82f6);
font-size: var(--hfx-size, 16px);
width: 15em;
border-radius: 0.75em;
overflow: hidden;
background: #fff;
border: 1px solid color-mix(in srgb, #000 10%, transparent);
color: #1f2937;
font-family: system-ui, sans-serif;
transition: transform 0.25s ease, box-shadow 0.25s ease;}
.hfx-card-lift:hover {
transform: translateY(-0.4em);
box-shadow: 0 1em 2em color-mix(in srgb, #000 15%, transparent);
}
.hfx-card-lift-image {
height: 7em;
background: linear-gradient(135deg, color-mix(in srgb, var(--c) 45%, #fff), var(--c));
}
.hfx-card-lift-body {
padding: 0.9em 1em 1.1em;
}
.hfx-card-lift h3 {
margin: 0 0 0.25em;
font-size: 1.05em;
}
.hfx-card-lift p {
margin: 0;
font-size: 0.85em;
color: #6b7280;
line-height: 1.4;
}
@media (prefers-reduced-motion: reduce) {
.hfx-card-lift, .hfx-card-lift *, .hfx-card-lift::before, .hfx-card-lift::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}The same effect using Tailwind utility classes. No custom CSS or config needed.
<article class="w-60 overflow-hidden rounded-xl border bg-white transition duration-200 hover:-translate-y-1.5 hover:shadow-xl">
<div class="h-28 bg-gradient-to-br from-blue-300 to-blue-500"></div>
<div class="p-4">
<h3 class="font-semibold">Weekend in Lisbon</h3>
<p class="text-sm text-gray-500">Three days of tiles, tarts and trams.</p>
</div>
</article>--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.