How to make text readable over background images: contrast tips for hero sections
Test the rendered background under every part of the text, including the brightest image areas and responsive crops. A 60% black scrim is a useful starting example for white text, not a universal minimum or substitute for checking the result.
Text over a background image can be hard to check because image brightness varies across the surface. WCAG contrast applies to text over images, but a single color sample won't describe every pixel behind a line of text. White text that's readable over a dark part of a photo may disappear over a bright sky, so check the rendered text against the image and any overlay behind it.
By TechCompare · Updated
How this is calculated
A scrim is a translucent layer between the photo and text. For opaque white text over an SDR sRGB white background, a 50% black overlay produces about #808080 and only 3.95:1 contrast, below AA normal text. A 60% black overlay produces #666666 and about 5.74:1. Gradients can darken only the text region, but each character still needs a passing background.
Verdict
A photo can have very different luminance beneath different parts of a text line, so one contrast check may miss a bright patch behind a character. WCAG contrast applies to text over images. Check the rendered result across the whole text area and responsive crops. A scrim or gradient can add contrast where needed, but its effect depends on the image and compositing. If no overlay works for every crop, place the text on a solid surface beside the image.
More Contrast scenarios
Related guides
Frequently asked questions
How do I check contrast on a gradient background?
How do I add a scrim overlay behind text on a hero image in CSS?
What is the minimum scrim opacity for AA compliance?
Related tools
Color Picker
Pick colors and convert between HEX, RGB, HSL, CMYK, and HSV formats.
Use tool ➜JSON Formatter
Validate, format, and minify JSON data with readable output and error detection.
Use tool ➜Aspect Ratio Visualizer
Visually compare width differences between 16:9, 21:9, and 32:9 monitors.
Use tool ➜