Why this matters in 2026
Hero sections and featured cards need text to pop over images without blocking them. The old approach — solid dark backgrounds or heavy drop shadows — feels dated. mix-blend-mode lets you tint and darken images non-destructively, preserving the photo while ensuring type remains readable. It's a pure-CSS solution that replaces the need for image editing or JavaScript overlays.
The logic
mix-blend-mode: multiply darkens the image where the overlay sits, making white text more legible. The overlay uses a gradient (light at top, dark at bottom) so the image stays vibrant near the top while text at the bottom gets enough contrast. Position absolute on the overlay and content layers keeps them stacked correctly within the relative hero container.
Why layered backgrounds? Combining linear-gradient(...) with a solid oklch() tint in one background property allows fine control: the gradient handles the fade, the tint adds a color cast (blue, purple, etc.) that matches your brand.
Accessibility & performance
Text on images must meet WCAG contrast ratios (4.5:1 for normal text). Test with real images — not all photos respond the same to the same overlay. Use text-shadow sparingly; it's a fallback enhancer, not a contrast fix. The overlay div is decorative — mark it empty or with aria-hidden="true". Performance-wise, blend modes are GPU-accelerated in modern browsers, but avoid animating them on scroll.
--overlay-opacity: 0.6; so designers can tune contrast per image.