Image alt tag

I have a page of photos each of which has a caption (<figcaption> tag). I can’t see any point in putting the same text in the alt attribute. Am I right that this would be a correct use of an empty alt attribute?

1 Like

That would be my understanding. agree

If the content that the image conveys is presented within text in the surrounding context of the image, then an empty alt attribute may suffice.

https://webaim.org/techniques/alttext/#context

3 Likes

There would be no point in putting the ‘same text’ in both but if you only put the text in the figcaption then it needs to describe what the image is rather than saying something about it.

Usually a caption would say something about the image rather than describing the image in detail. e.g. <figcaption>A Picture of me on holiday</figcaption>. To a non sighted reader that would not be much help because you might be swimming, hang-gliding or sunbathing :slight_smile:

e.g. from here.

<figure> <img src="664aef.jpg" alt="Lola the cat sitting under an umbrella in the bath tub.">
  <figcaption>Lola prefers a bath to a shower.</figcaption>
</figure>

So to satisfy the above requirements without an alt attribute you would need to say.

<figure> <img src="664aef.jpg" alt="">
  <figcaption>Lola the cat sitting under an umbrella in the bath tub.</figcaption>
</figure>
4 Likes

I knew it wouldn’t be as simple as I thought. Thanks guys.

Ma heid is mince.

2 Likes

Well to sum up, if the description of the image (alt text) is significantly different to the caption (like Paul’s example) you may want to include both.
Another example would be something like a newspaper cartoon, or internet meme. It may have a caption, which in isolation is meaningless, but with the additional context of the image (or a text description of what it portrays), the humor is apparent.

On the other hand, if they are virtually the same, one is redundant and may be omitted.

3 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.