Meek
Meek

Reputation: 3348

Accessibility: alt or alt="" for decorative images

In terms of WCAG 2.0 accessibility, is an empty alt-tag equally valid if it's written alt or alt="" in the html? Like this:

 <img src="some-image.jpg" alt="">

 <img src="some-image.jpg" alt>

Are they both valid for stating decorative images?

Inspecting an image with alt="" in a browser's DevTools will display alt, so is it valid to just write alt in the html?

Upvotes: 3

Views: 710

Answers (2)

leun4m
leun4m

Reputation: 590

Both should be treated equally.

According to the HTML Standard:

Empty attribute syntax

Just the attribute name. The value is implicitly the empty string.

Upvotes: 1

Lucas da Paz
Lucas da Paz

Reputation: 31

They are the same: https://stackoverflow.com/a/44764507/18717610 A screen reader will not read the image with an empty alt attribute.

Upvotes: 1

Related Questions