W3C home > Mailing lists > Public > www-html@w3.org > April 2001

Re: HTML Document conventions.

From: Masayasu Ishikawa <mimasa@w3.org>
Date: Mon, 23 Apr 2001 19:47:59 +0900
To: Skult@Softhome.net
Cc: www-html@w3.org
Message-Id: <20010423194759W.mimasa@w3.mag.keio.ac.jp>
"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

Masayasu Ishikawa / mimasa@w3.org
W3C - World Wide Web Consortium
Received on Monday, 23 April 2001 06:47:55 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:56 UTC