A very common fault among websites is that they partially set the colour scheme, but leave the rest to defaults. The problem is that, like font sizes and window widths, these defaults can also change from one visitor to the next. The designer cannot assume that all his visitors use the same defaults as he does, or as each other.
For example, if the designer's default foreground colour is black, and he specifies a white background for a page, he sees his text perfectly clearly in his own tests. Indeed, most of his visitors will probably have dark text on a pale background as their defaults, so they also see the text when they visit, as the page's black text contrasts well with their pale backgrounds. But if a visitor has dared to set an alternative default colour scheme, such as light text on dark, her light text is rendered against the designer's white background, and disappears.
So, when you specify any colour, specify all the others
with it. If you specify a background colour for <body>
, but no foreground colour, the
browser will use its default foreground which might clash
with your choice of background. There is no default ‘white’
or ‘grey’ background, or default ‘black’ foreground – if you
don't specify, you're accepting the visitor's choice. If you
half-specify, you're saying that your part of the colour
scheme is compatible with the visitor's part, which is absurd
unless you're psychic! This goes for background images
too.
In summary:
Don't specify some colours but not others. The visitor's default colours might not go with yours.
Don't specify a background image without a background colour. Image rendering might be disabled, and your specified foreground colour and the visitor's background colour might be incompatible. And if images are enabled, you'd need a foreground colour too, of course.
If you have images that don't have a transparency mask, but do have some sort of non-rectangular shape, and you're not prepared to put a border around them, but rather want them to merge in seemlessly with the background, you must explicitly specify that background colour (and all the others, of course). The number of times I've seen sites spattered with white rectangles on my default grey background…
Don't rely on HTML to provide some parts of the colour scheme and CSS to provide the remainder. What if CSS is disabled?
Don't rely on <body>
attributes to provide one part of the colour scheme, and
<font color="">
or
<table bgcolor="">
to
provide the other. One part might be disabled or not
supported, while the other is. Indeed, just don't bother
with <font color>
or
<table bgcolor>
,
because they don't support setting the full colour scheme
as standard.
The ideal situation would be that browsers keep track of whether each aspect of a colour scheme has been specified, and only apply the actual colours if enough have been specified, or the scheme can be automatically and sensibly completed. Some client-side scripting might be able to do this.