I run into this problem a lot. Imagine I’ve got a picture of, say, Sam
and I at a party. I’d like to post that picture here. So, I’d have the
picture and then, below it, a caption saying “This is Sam and I at the
Beckham’s party“. But then what should I use as the alt text on the
picture? Clearly the alt text should be “Sam and I at the Beckham’s
party“, or perhaps even a longer description of the image. However, then
the caption is redundant; if someone browses the page with images off
then it will (correctly) display the alt text in place of the picture,
leaving the page saying “This is Sam and I at the Beckham’s party. Sam
and I at the Beckham’s party.”
Those of you saying: appropriate alt text for that image is therefore
the empty string, since there already is a caption in the
HTML; what should I do if i want the image to
be a link to beckhams-party.com? If I make the alt text empty then the
link is unusable in text-only browsers.
Perhaps I should, for example, make the alt text empty and wrap both
the image and the caption in the link, thus covering both those bases.
That only works if the caption is the thing immediately following the
image, though. Semantic HTML people, what
would you recommend?
What to do about alt text
I'm currently available for hire, to help you plan, architect, and build new systems, and for technical writing
and articles. You can take a look at some projects I've worked on and
some of my writing. If you'd like to talk about your upcoming project,
do get in touch.