3

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?

Meek
  • 3,086
  • 9
  • 38
  • 64

2 Answers2

1

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

Lucas da Paz
  • 21
  • 1
  • 5
1

Both should be treated equally.

According to the HTML Standard:

Empty attribute syntax

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

leun4m
  • 560
  • 5
  • 24