[whatwg] Definition of alt= attribute

Matthew Raymond mattraymond at earthlink.net
Sat Jan 21 03:25:12 PST 2006

Alexey Feldgendler wrote:
> On Fri, 20 Jan 2006 16:55:43 +0600, Matthew Raymond  
> <mattraymond at earthlink.net> wrote:
>>> This sounds reasonable. I guess I should change my statement:
>>> The alt attrubute should be made optional, and when it's omitted, the UA
>>> should try to obtain some useful information from the file name or by
>>> other means.
>>    I'm not sure I agree. If you look at what you might use <img> for,
>> it's almost always presentational, and could therefore be done with CSS.
>> The more semantic the image, the more necessary alternate content
>> becomes, thus making the |alt| attribute necessary for a truly semantic
>> <img> element. If you find yourself using <img alt=""> a lot, it's
>> probably because you're not making proper use of CSS, or because you're
>> using <img> elements to achieve a presentational effect that is
>> currently not possible with just CSS 2.1 (yet may likely be possible in
>> CSS 3).
> I'm not speaking about <img> with specified but empty alt -- this one is  
> certainly presentational, and it's OK to require explicit alt="" for this  
> case.

   If an <img> element is being used in a "certainly presentational"
way, should it not be done away with in favor of CSS?

> I'm speaking about <img> with totally omitted alt, which is  
> currently invalid.

   And my point it that it _should_ be invalid because for any semantic
image you would actually want alternate content.

> I propose to allow it and have the user agent derive
> some information from the image URL. This will better reflect the real  
> world situation: many authors actually omit alt (which results in an  
> invalid page) when they actually should have written it.

   I suspect that the actual image name is frequently useless in
determining alternate content. In fact, I'd surmise that most images
that don't have |alt| attributes are presentational, and therefore
should be done via CSS instead. The use of <img> elements in many cases
is actually there to support older browsers like Netscape Navigator 4.x.
Markup targeting more modern user agents drastically reduces the need
for <img>.

   Hmm... Is <img> ever non-presentational? Radical thought: Deprecate

More information about the whatwg mailing list