by nodesocket · 14y ago · 0 comments
In general though, the `alt`-attribute should be present. If the image is purely decorative, the value should be an empty string (although CSS rather than `img`-tags are recommended for purely decorative images anyway).
The purpose of the alt-text is some text to replace the image if you are browsing without images (e.g. using lynx or a screen-reader). Empty string means no replacement text, while a missing alt-attribute could be replaced with a text saying eg. "[unknown image]".
It makes sense.
Making the alt tag required won't make lazy developers/content providers any less lazy, so requiring it actually weakens the signal you're looking for.
At least requiring one makes them think about it. And tools can put in "image".