Home > database >  Accessibility: alt or alt="" for decorative images
Accessibility: alt or alt="" for decorative images

Time:01-27

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?

CodePudding user response:

Both should be treated equally.

According to the HTML Standard:

Empty attribute syntax

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

CodePudding user response:

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

  • Related