It has become popular to use hidden text as alt-text for background images. I don't personally encourage or discourage this. But, I always want to be able to give clients the solution that requires the least change from their current design. Sure, you could break one large image into small images with alt-text. Then, surround those images with markup. Then you could use css to remove the visual effects of that markup and get the different pieces of the image back together. That should be fine! However, easier is better when it comes to advising clients. And easier/faster may mean more accessibility overall.
This explores: is it possible to used hidden marked-up text as alt-text for background images without leaving out any users. It must be available:
And, it must not appear from behind things when a user resizes the text. Text resize does have advantages for some users over using zoom. And messy hard-to-read layouts can result if text-resize brings bits and pieces of hidden text into view.
In this technique we simply use background images to hide the text. This way, when the background images are not present, no matter the reason, the text will be present. And otherwise, the text is not visible, but is read by screen readers.
There is an image at the top of this page that includes the number four. So we're imagining that this image is the image the client wants. And we're imagining it includes text that is essential to the page and so shouldn't be in a long description. We're also imagining that this is text that would be best marked up with html tags, rather than appearing as alt-text.
The div
with the image is sized using pixels. The div
with the text does not have a width specified, so, with text resize, it could be any size and might not be able to be hidden behind the image.