Search topics
Low-contrast text over photos and hero images
White words are laid straight on a photo or a slideshow image, or on a panel too thin to matter, so they fade wherever the picture turns bright.
.slide-text { color: #fff; } The problem
People with low vision can't read the headline over a hero photo or a slide, wherever the photo behind it is bright
A homeware shop opens its home page with a slideshow of three photos: linen napkins folded by a window, a towel on a stone counter, a table laid with a linen runner. The photos are soft and bright on purpose, and each slide lays a white headline, a line of text and a white "Shop" button over the top left of its photo, the way Bootstrap's carousel sets its captions: white, with nothing behind them. In the design file the words sat over the linen, and they looked calm and light.
On the live page the photos are cropped to the width of the window, and the top left of each one is the brightest part of the room: the window and the pale wall. The headline fades into it, and the line under it, at 17 pixels, is barely there. Press Next slide and the second and third photos are just as bright. Some shops notice and put a dark panel behind the words, but at 30% black it hardly changes how white text looks on a bright photo.
WCAG 1.4.3 asks for at least 4.5:1 for normal text, and 3:1 for large text: 24px and up, or 18.66px and up when bold. The headline is 32px bold, so it needs 3:1; the line under it is 17px and needs 4.5:1. Text over a photo is measured against what is really behind its letters, and a photo has no single colour, so the part that counts is the one that gives the least contrast. Failure F83 names this case: a background image that doesn't give the text enough contrast.
- Straight on the photo: behind the first slide's headline, the window reaches
#fcfbfc, and white on it is 1.03:1. On the second slide, the wall behind the words is#e8e1d6, at 1.30:1. - On a 30% black panel: on the first slide the panel comes out at
#a8a49aat its lightest, and white on it is 2.49:1. Where a photo is pure white, 30% black is#b3b3b3, at 2.10:1.
Nothing in CSS keeps text readable on whatever is behind it. The browser draws the colour the stylesheet gives, over whichever photo an editor uploads, so the designer has to plan for the brightest photo the slot will ever get, not the one in the mock-up.
A glossy phone screen outdoors washes out the light half of a photo further, so a hero that is hard to read on a laptop can vanish on a phone. Slideshows add to it: each slide has its own photo, and a slide that is easy to read tells nothing about the next.
1 of 10 groups affected
- No vision (not affected)
- Low vision (affected)
- Colour vision (not affected)
- No hearing (not affected)
- Hard of hearing (not affected)
- No speech (not affected)
- Motor (not affected)
- Reach, strength (not affected)
- Cognitive (not affected)
- Seizures (not affected)
- Limited vision People with low vision, and many older readers, lose white words first where the photo turns pale: the letters melt into a window or a wall, and the headline has to be guessed.
Most checkers stop at the image. axe leaves text over a background image or a gradient as "needs review", because it can't tell what colour is behind each letter. EaseWeb's audit measures it: for text with an image, a gradient or a video under it, it scrolls the text into view, waits for it to stop moving or fading, hides the words, takes a screenshot of the text's box, and measures the text colour against those pixels, taking the worst colour that covers a real part of the area rather than one stray pixel. Text drawn in a see-through colour, or with opacity, becomes a lead for a person to measure. It measures what is on screen when it runs: a slide that is hidden at that moment, and any photo uploaded later, is never measured. It also hides text shadows along with the words, so text that relies on a shadow is reported, and a person decides. An AI tool asked to review a mock-up sees only the photo in it, never the ones editors will upload later.
Try it
Read the headline and the line under it, then do the same on every slide
Broken 1: the white words sit straight on the photo. Use Next slide to go through all three: can you read every word on each one?
Broken 2: the words sit on a see-through dark panel. Is it dark enough where the photo behind it is brightest?
Apply a fix. Go through the slides again: can you read every word on each one now?
Broken Can you fix this?
The fix
Give text over a photo a backing that holds on any photo
White words straight on the photo
<div class="slide"> <img src="/images/linen-napkins.jpg" alt=""> <div class="slide-text"> <h2>Linen for the table</h2> <p>Napkins, runners and tea towels, washed soft.</p> <a href="/linen">Shop table linen</a> </div></div>What is wrong4 points
- The white words have nothing behind them but the photo.
- Behind the headline the window reaches
#fcfbfc: 1.03:1, where the 32px bold headline needs 3:1. - The line under it is 1.03:1 too, where 17px text needs 4.5:1.
- The other two slides are as bright, and the words don't change to match them.
A panel behind the words
<div class="slide"> <img src="/images/linen-napkins.jpg" alt=""> <div class="slide-text"> <h2>Linen for the table</h2> <p>Napkins, runners and tea towels, washed soft.</p> <a href="/linen">Shop table linen</a> </div></div>How it is fixed2 steps
- Give the words a panel of 60% black. Over the brightest a photo can be, pure white, the panel is
#666666, and white text on it is 5.74:1, so both the headline and the line under it pass on any photo. - Pad the panel, so the words never touch its edge where the photo shows through.
This fixes both Befores and passes 1.4.3 on every slide, whatever photo an editor puts in. The rest of each photo stays as bright as it was.
Each of the four passes. The panel holds on any photo and leaves the rest of it bright, at the cost of a dark box over the picture. The gradient shows more of the photo, but holds only while the words stay low, so it needs measuring at every width. The darker photo is the simplest, and it suits a photo that sets a mood more than one that shows the product. Moving the words under the photo is the only option that never depends on the photo at all: choose it when the photos are what sells, or when editors will swap them without anyone measuring.
Build the backing into the slide or banner component, so it doesn't depend on which photo an editor picks. A theme setting for "overlay opacity" that starts at 0, as the image banner and the slideshow in Shopify's Dawn theme do, leaves every merchant who turns off the box behind the text to find the problem alone. Give the setting a floor that passes instead, or drop it.
Design to the worst case, not the average. A panel picked against the photo's average colour passes in the mock-up and fails on the next photo. The safe value for white text is the backing over pure white, and for dark text, the backing over pure black: a panel of 85% white is #d9d9d9 over black, where #1a1a1a text is 12.33:1.
Some backings change the look without changing the ratio.
- A blur behind the words (
backdrop-filter: blur()) calms a busy photo, but leaves it just as light; count only the darkening in the ratio. - A soft text shadow seldom darkens enough of what is right behind each letter. Understanding 1.4.3 treats a wide outline that fills in the letters' inner details as a halo, part of the background, and says nothing of shadows, so measure the colour right around each letter if you rely on one.
- An
opacityon the text, or a see-through text colour, makes the words lighter than their token, so measure what is drawn.
The same holds for every slide, including slides that are hidden until a button or a timer shows them, and for a looping video behind a headline, where every frame counts. The slideshow's arrows and dots are covered in carousels that keyboard and screen reader users can't use, and a slideshow that moves by itself in tickers, carousels and animations that can't be paused. In forced colors, Chromium draws a plain backplate behind text over images; check the hero there rather than assume.
Design ideas
Words on a photo can stay light and calm, and still be read
Five more ways to set a slide’s words over the shop’s photos. Point at each one and Tab to it: three keep their ratio over any photo, and two lose it where the photo is bright.
In the design file
- Draw every slide and banner over the brightest photo it might get, not only the one in the mock-up.
- Write the backing beside the words, with how see-through it is and its ratio over pure white. Normal text needs 4.5:1 and large text 3:1; 60% black gives 5.74:1, and 30% black only 2.10:1.
- Draw the phone width too, with the headline wrapped onto every line it takes, still on its backing.
- Leave a text shadow out of the count, and give the ratio of the words against the photo without it.
Passes
- Dark words on a frosted panel A panel of 85% white, with the photo blurred behind it, keeps the photo’s warmth and lets dark words sit anywhere on it. Even over pure black the panel is #d9d9d9, where the #1a1a1a words are 12.33:1.
- A photo toned in one deep colour The photo is turned grey and multiplied over the shop’s deep green, #24433a, so its brightest point can only reach that green. White words are at least 10.83:1 anywhere on it, and the photo still reads.
- A card over the photo’s edge The words sit on a white card that overlaps the bottom of the photo, so the photo stays whole above them and the slide still reads as one piece. The #1a1a1a words are 17.40:1 on the card, whatever the photo.
Fails
- White words with a soft shadowWCAG 1.4.3 The shadow darkens only a blur around each letter. Behind the headline the window still reaches #efefef, where white is 1.15:1 and the headline needs 3:1.
- An outlined button on the photoWCAG 1.4.3 A white outline and a white label with nothing filled in between, so the label sits straight on the photo. Over the pale floor it is 1.40:1, where a 15px label needs 4.5:1.
Verify the fix
3 checks, no mouse.
Test with: Contrast measurement, Zoom, Forced colors
Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the photos, the slideshow's layout or the theme change.
Limits
This is a starting pattern, not a guarantee for every application. The colour values are examples; measure your own backings over your real photos. Text that is part of the photo itself, such as a street sign, is incidental and not covered by 1.4.3; words drawn into an image file are covered in images of text instead of real HTML text. Text in a brand colour, and text that fades on hover, are in low-contrast text in brand colours and hover states, and the 7:1 of Level AAA in grey body text under 7:1 contrast. A contrast ratio is a minimum, not proof that text is comfortable to read over a photo: check the complete pages with people who rely on it.
This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.
EaseWeb service
Fixed it? Keep it from coming back.
I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.