Weekend in Lisbon
Three days of tiles, tarts and trams.
An accent tint washes over the photo and a round magnifier button spins in with a small overshoot, the usual cue that a click opens a lightbox. The icon is inline SVG.
Also known as: image hover with icon, zoom icon overlay, gallery plus icon hover.
<a href="#" class="hfx-image-overlay-icon" aria-label="Open image">
<span class="hfx-image-overlay-icon-photo"></span>
<span class="hfx-image-overlay-icon-button">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="6.5"/><path d="m20 20-4.2-4.2M11 8v6M8 11h6"/></svg>
</span>
</a>.hfx-image-overlay-icon {
--c: var(--hfx-color, #3b82f6);
font-size: var(--hfx-size, 16px);
position: relative;
display: grid;
place-items: center;
width: 15em;
height: 9.5em;
border-radius: 0.75em;
overflow: hidden;
}
.hfx-image-overlay-icon-photo {
position: absolute;
inset: 0;
background:
radial-gradient(70% 40% at 16% 110%, color-mix(in srgb, var(--c) 18%, #0b0a1f) 99%, transparent),
radial-gradient(66% 38% at 88% 108%, color-mix(in srgb, var(--c) 24%, #0b0a1f) 99%, transparent),
conic-gradient(from 128deg at 68% 44%, transparent 0, color-mix(in srgb, var(--c) 32%, #1e1b4b) 0.4deg 103.6deg, transparent 104deg),
conic-gradient(from 119deg at 90% 52%, transparent 0, color-mix(in srgb, var(--c) 32%, #1e1b4b) 0.4deg 121.6deg, transparent 122deg),
conic-gradient(from 123deg at 24% 40%, transparent 0, color-mix(in srgb, var(--c) 42%, #6b2159) 0.4deg 113.6deg, transparent 114deg),
conic-gradient(from 125deg at 46% 54%, transparent 0, color-mix(in srgb, var(--c) 42%, #6b2159) 0.4deg 109.6deg, transparent 110deg),
radial-gradient(circle at 38% 58%, #fef3c7 0 1em, rgb(254 215 170 / 0.55) 1.1em, transparent 4.2em),
linear-gradient(color-mix(in srgb, var(--c) 58%, #1e1b4b), color-mix(in srgb, var(--c) 34%, #f472b6) 52%, color-mix(in srgb, var(--c) 12%, #fdba74) 76%);
transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.hfx-image-overlay-icon::after {
content: "";
position: absolute;
inset: 0;
background: color-mix(in srgb, var(--c) 55%, transparent);
opacity: 0;
transition: opacity 0.35s ease;
}
.hfx-image-overlay-icon-button {
position: relative;
z-index: 1;
display: grid;
place-items: center;
width: 2.8em;
height: 2.8em;
border-radius: 50%;
background: #fff;
color: var(--c);
box-shadow: 0 0.4em 1em rgb(2 6 23 / 0.3);
opacity: 0;
transform: scale(0.4) rotate(-90deg);
transition: opacity 0.25s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hfx-image-overlay-icon svg {
width: 1.35em;
height: 1.35em;
}
.hfx-image-overlay-icon:is(:hover, :focus-visible) .hfx-image-overlay-icon-photo {
transform: scale(1.05);
}
.hfx-image-overlay-icon:is(:hover, :focus-visible)::after {
opacity: 1;
}
.hfx-image-overlay-icon:is(:hover, :focus-visible) .hfx-image-overlay-icon-button {
opacity: 1;
transform: none;
}
@media (prefers-reduced-motion: reduce) {
.hfx-image-overlay-icon, .hfx-image-overlay-icon *, .hfx-image-overlay-icon::before, .hfx-image-overlay-icon::after, .hfx-image-overlay-icon *::before, .hfx-image-overlay-icon *::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.