Weekend in Lisbon
Three days of tiles, tarts and trams.
Two slanted panels wipe in from the left, a pale sliver first and the accent panel a beat later, leaving the right of the photo in view beside the caption. Each panel is one clip-path polygon.
Also known as: slanted overlay hover, angled caption panel, skew wipe image.
<a href="#" class="hfx-image-diagonal-wipe">
<span class="hfx-image-diagonal-wipe-panel">
<small>New route</small>
<strong>Coastal ridge walk</strong>
</span>
</a>.hfx-image-diagonal-wipe {
--c: var(--hfx-color, #3b82f6);
font-size: var(--hfx-size, 16px);
position: relative;
display: block;
width: 15em;
height: 9.5em;
border-radius: 0.75em;
overflow: hidden;
background:
radial-gradient(9% 30% at 50% 74%, rgb(255 255 255 / 0.55), transparent),
linear-gradient(transparent 62%, color-mix(in srgb, var(--c) 78%, #0f172a) 62%, color-mix(in srgb, var(--c) 62%, #0f172a) 74%, color-mix(in srgb, var(--c) 40%, #020617)),
radial-gradient(34% 16% at 6% 63%, color-mix(in srgb, var(--c) 36%, #0f172a) 99%, transparent),
radial-gradient(20% 9% at 92% 62%, color-mix(in srgb, var(--c) 48%, #1e293b) 99%, transparent),
radial-gradient(circle at 50% 50%, #fffbeb 0 0.9em, rgb(254 243 199 / 0.5) 1em, transparent 3.6em),
linear-gradient(color-mix(in srgb, var(--c) 56%, #fff), color-mix(in srgb, var(--c) 18%, #fed7aa) 62%);
color: #fff;
font-family: system-ui, sans-serif;
text-decoration: none;
}
.hfx-image-diagonal-wipe::before,
.hfx-image-diagonal-wipe-panel {
position: absolute;
top: 0;
bottom: 0;
left: 0;
clip-path: polygon(0 0, 100% 0, 76% 100%, 0 100%);
transform: translateX(-101%);
transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1);
}
.hfx-image-diagonal-wipe::before {
content: "";
right: 30%;
background: color-mix(in srgb, var(--c) 40%, #fff);
}
.hfx-image-diagonal-wipe-panel {
right: 38%;
display: grid;
align-content: center;
gap: 0.3em;
padding: 0 2.4em 0 1em;
background: color-mix(in srgb, var(--c) 88%, #0f172a);
transition-delay: 0.06s;
}
.hfx-image-diagonal-wipe small {
font-size: 0.65em;
font-weight: 600;
letter-spacing: 0.14em;
text-transform: uppercase;
opacity: 0.8;
}
.hfx-image-diagonal-wipe strong {
font-size: 1.1em;
line-height: 1.15;
}
.hfx-image-diagonal-wipe-panel > * {
opacity: 0;
transform: translateX(-0.6em);
transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.hfx-image-diagonal-wipe:is(:hover, :focus-visible)::before,
.hfx-image-diagonal-wipe:is(:hover, :focus-visible) .hfx-image-diagonal-wipe-panel {
transform: none;
}
.hfx-image-diagonal-wipe:is(:hover, :focus-visible) .hfx-image-diagonal-wipe-panel > * {
opacity: 1;
transform: none;
transition-delay: 0.3s;
}
@media (prefers-reduced-motion: reduce) {
.hfx-image-diagonal-wipe, .hfx-image-diagonal-wipe *, .hfx-image-diagonal-wipe::before, .hfx-image-diagonal-wipe::after, .hfx-image-diagonal-wipe *::before, .hfx-image-diagonal-wipe *::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.