Images and accessibility
alt attribute mandatory on
img elements? If not, can you describe a scenario where it can be set to an empty value? Does an empty value affect accessibility in any way?
The alt attribute is mandatory on
img elements but its value can be empty (i.e.
alt=""). An empty value is recommended when the image shown is used for decorative purposes only and therefore isn’t part of the content of the page. With regards to accessibility, if the
alt attribute is empty, screen readers will ignore the image. This is highly recommended because using a value of something like “Content separator” will only disturb the user when this text is spoken.