Humanist Discussion Group, Vol. 16, No. 242.
Centre for Computing in the Humanities, King's College London
Submit to: email@example.com
Date: Thu, 03 Oct 2002 06:42:24 +0100
From: Norman Gray <firstname.lastname@example.org>
Subject: Re: 16.231 why the #? theory vs practice (fwd)
> stumbled across the following: Many reference sources on HTML will insist
> that when encoding a/any color, the RGB color value should be preceded by
> an hash e.g.
> <BODY BGCOLOR="#FFFFFF">
> and yet, quite by accident (memory failure), I omitted the hash in numerous
> examples. Even so, the colors were rendered, both in IE5.5 and NN4.7 on
The answer is that it's in principle required, but it's not actually required.
The definition of the <body> element  defines the content of the
bgcolor attribute thus:
Colors are given in the sRGB color space as hexadecimal numbers
(e.g. COLOR="#C0FFC0"), or as one of 16 widely understood color
names. These colors were originally picked as being the standard 16
colors supported with the Windows VGA palette.
And the colours are Black, Silver, ..., Teal, Aqua. Thus the hash is
required to distinguish colour names from colour specifications (also,
for a variety of historical reasons, it just `looks right' having a
hash before hexadecimal numbers).
Now, there are in fact no colours (from this set at least) which are
named with just the letters 0-9, A-F, so browsers are written to Do
The Right Thing if they see a colour specification without the hash, as
you've discovered. Therefore the hash isn't practically required, in much
the way that apostrophes aren't practically required in modern english.
Whether this is in fact the Right Thing or the Wrong Thing is hotly
debated. It will, however, depend on the browser.
The W3C, and HTML and browsers in particular, is an excellent example
of a battleground between theory and practice, with any number of
short and long term imperatives warring over it, and sometimes even
warring with themselves. Quoth Roy Fielding:
[...] I can say with authority that the W3C was created by big
businesses specifically to prevent their own marketing departments
from destroying the value inherent in the Web through their own,
and their competitors', short-sighted, quarterly-revenue-driven
pursuit of profits. 
All the best,
(language lawyer and standards junkie)
 http://www.w3.org/TR/REC-html32#body (for HTML 3.2: HTML 4 is the
same, but HTML 2 did not include the bgcolor attribute)
-- --------------------------------------------------------------------------- Norman Gray http://www.astro.gla.ac.uk/users/norman/ Physics and Astronomy, University of Glasgow, UK email@example.com
This archive was generated by hypermail 2b30 : Thu Oct 03 2002 - 01:55:23 EDT