Skip to main content
All interview theory questions
accessibilityeasy

How do you decide what to put in an image's alt attribute?

Answer

Ask what the image is doing. If it carries information, describe that information rather than the picture. If it's a link or button, describe the destination or action. If it's purely decorative, use an empty alt="" so screen readers skip it — omitting the attribute entirely is worse, because some readers then announce the filename. Don't prefix with "image of"; the element already says that.

Points an interviewer listens for

  • Convey the image's purpose, not its appearance
  • Functional images describe the action or destination
  • Decorative images get alt="", never a missing attribute
  • No "image of" prefix

Reported at

Similar questions have been reported by candidates at Accenture, Boston Institute of Analytics, Codegene Technologies Private Limited, Tekwissen.

Now try answering it out loud

Interview practice mode times your spoken answer and checks it against the points above.

Practise this question

More accessibility questions