4 ms·
Anybody else think its a little absurd that `alt` on img tags are still required for valid HTML?
by nodesocket 14y ago
Anybody else think its a little absurd that `alt` on img tags are still required for valid HTML?
- olavk 14y agoIn HTML5, the `alt`-attribute can be left out there is no way to provide an appropriate alternative text. The spec provides the example of "a blind photographer sharing an image on his blog". 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.
- 0x0 14y agoIt's absolutely ridiculous, especially since you can get away with alt="".
- TazeTSchnitzel 14y agoNo it's not. An empty alt specifies that it's a presentational image. On the other hand, no alt is unhelpful, as you can't tell if the omission was intentional, or the developer is just lazy.
- 0x0 14y agoIs it better that the lazy developer is forced to insert empty alt="" to get the site to validate? Your argument is actually in favor of an optional alt tag. Allowing for a missing alt tag means you CAN tell the difference between an intentional empty alt, or a lazy developer missing the tag.
- TazeTSchnitzel 14y agoAllowing for a missing alt tag means developers don't even have to consider providing alt info, which is a terrible idea. At least this way they have to put something there, even if it's blank.
- 0x0 14y agoHow is it better that every single image on a page has alt="image" or alt="asdfasdf", instead of a missing alt-tag? If the alt tag was recommended - but optional - then a missing alt-tag tells you the developer didn't think about it (and who knows if the image is significant), while a present but empty alt-tag indicates the image really is decorative/insignificant. As long as the alt-tag is required, a valid site will contain alt="" all over the place, and you can't know whether that's because the site developer was lazy (but was using validating tools) or if the site developer decided to flag those images insignificant. Am I feeding a troll here? (edit: It's like the difference between an SQL NULL and an empty string.)
- TazeTSchnitzel 14y agoNo, I'm not trolling. I just disagree.
- kalleboo 14y agoAn empty alt can also just mean "I used a tool to generate this and didn't fill out the alt field" or "I just want this page to validate and still don't care". 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.
- TazeTSchnitzel 14y agoAnd then if we make it optional, now developers and software don't have to even consider putting any alt content. At least requiring one makes them think about it. And tools can put in "image".
- DanBC 14y agoNo. Why is it absurd?