Re: HTML Document conventions.

"Skult" <Skult@Softhome.net> wrote:

> If I'm right, quotation marks are only needed when attribute values are not
> alphanumeric (like #FFFFFF for example where the "#" makes quoting
> necessary)...
> 
> There are some exceptions, though (like hyphens)...

I think you have already found which part of the spec talks about this,
but for readers' convenience - in HTML 4, "3.2.2 Attributes" [1] says:

   By default, SGML requires that all attribute values be delimited using
   either double quotation marks (ASCII decimal 34) or single quotation
   marks (ASCII decimal 39). Single quote marks can be included within
   the attribute value when the value is delimited by double quote marks,
   and vice versa. Authors may also use numeric character references to
   represent double quotes (&#34;) and single quotes (&#39;). For double
   quotes authors can also use the character entity reference &quot;.

   In certain cases, authors may specify the value of an attribute
   without any quotation marks. The attribute value may only contain
   letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45),
   periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons
   (ASCII decimal 58). We recommend using quotation marks even when it is
   possible to eliminate them.

In XHTML 1.0, as section 4.4 [2] says, attribute values must always
be quoted, as required by XML 1.0.  That is true for all the other
XHTML Family document types (XHTML Basic, XHTML 1.1, ...), too.

[1] http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2
[2] http://www.w3.org/TR/xhtml1/#h-4.4

Regards,
-- 
Masayasu Ishikawa / mimasa@w3.org
W3C - World Wide Web Consortium

Received on Monday, 23 April 2001 06:47:55 UTC