Space in 'alt' attribute problematic w.r.t. HTML 4.01


Vincent Lefèvre sent an email to me earlier this year
explaining a problem with one of the WCAG 1.0 Techniques
for HTML suggestions. From section 6.1.1 [1]:

  "Or, if you provide link text, use a space as the 
  "alt" attribute value of the IMG element. Note that 
  this text will appear on the page next to the image."

However, in the HTML 4.01 DTD, for the IMG element, we have:

  %attrs;                              -- %coreattrs, %i18n, %events --
  src         %URI;          #REQUIRED -- URI of image to embed --
  alt         %Text;         #REQUIRED -- short description --

where %Text; is CDATA. HTML 4.01 says about CDATA [2] that:

  User agents may ignore leading and trailing white space in CDATA
  attribute values (e.g., "  myval  " may be interpreted as "myval").
  Authors should not declare attribute values with leading or trailing
  white space.


    Is a single space considered leading space? Perhaps not.
    I guess that we would have to see the definition in SGML.
    It can't be suppressed without changing the meaning of the
    attribute value, so it may not be considered leading.
 - Ian

Ian Jacobs (
Tel:                     +1 718 260-9447

Received on Wednesday, 26 December 2001 11:37:54 UTC