The ALT attribute and its semantics

On Wed, 17 Aug 2005, David Woolley wrote:

>>        <img src="enter.gif">
>
> As well as being off topic, that's not valid HTML!

Well, practical "how do I..." questions are off-topic here, but the markup 
above _is_ valid - when using an HTML 2.0 document type. Although it was 
questionable to make the ALT attribute optional, and although this was 
fixed in subsequent HTML specifications, the HTML 2.0 specification was 
here, as usual, a big improvement over its successors in clarity
of semantic definitions:

"HTML user agents may process the value of the ALT attribute as an 
alternative to processing the image resource indicated by the SRC 
attribute."

and

"ALT
   text to use in place of the referenced image resource, for example due
   to processing constraints or user preference."

Compare this with the awful "short description" characterizations in HTML 
4.01 specification or with its definition
"For user agents that cannot display images, forms, or applets, this 
attribute specifies alternate text."
followed by prose that talks of many things, including browsers that _can_ 
display images...

The morale is, I think, that the specification of a markup language should 
clearly distinguish normative semantic definitions and requirements from 
explanatory prose (and both of them from syntactic requirements). 
Naturally, the explanatory text should be reasonably consistent with the 
normative text, since people often confuse the two anyway.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Thursday, 18 August 2005 05:27:28 UTC