Weekend in Lisbon
Three days of tiles, tarts and trams.
The title sits low on the image; on hover it rises and a description fades in beneath it. Everything is positioned inside the image, so the card's footprint never changes.
Also known as: hover reveal description, text slide up card.
Palaces, mist and pastel walls, forty minutes from the city.
<figure class="hfx-card-content-rise">
<div class="hfx-card-content-rise-image"></div>
<figcaption>
<h3>Sintra day trip</h3>
<p>Palaces, mist and pastel walls, forty minutes from the city.</p>
</figcaption>
</figure>.hfx-card-content-rise {
--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;
position: relative;
margin: 0;
aspect-ratio: 4 / 3;}
.hfx-card-content-rise-image {
position: absolute;
inset: 0;
background: linear-gradient(135deg, color-mix(in srgb, var(--c) 45%, #fff), var(--c));
}
.hfx-card-content-rise figcaption {
position: absolute;
inset: auto 0 0;
padding: 1em;
background: linear-gradient(to top, color-mix(in srgb, #000 70%, transparent), transparent);
color: #fff;
transform: translateY(1.8em);
transition: transform 0.35s ease;
}
.hfx-card-content-rise h3 { margin: 0; font-size: 1.05em; }
.hfx-card-content-rise p {
margin: 0.3em 0 0;
font-size: 0.8em;
line-height: 1.4;
opacity: 0;
transition: opacity 0.35s ease 0.1s;
}
.hfx-card-content-rise:hover figcaption { transform: translateY(0); }
.hfx-card-content-rise:hover p { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
.hfx-card-content-rise, .hfx-card-content-rise *, .hfx-card-content-rise::before, .hfx-card-content-rise::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.