If You Pick One Color, Pick Them All

If You Pick One Color, Pick Them All

A surprising number of Web sites have color specified for body text, headings, and links of all kinds yet not for the background. Because your visitor may have any color set in their preferences, they may:

The rule of thumb to avoid these problems is: If you specify one color, you must specify them all.

Recommended Practices

Forget <font>, use CSS

The proper, modern way to set color in a Web page is to use Cascading Style Sheets. This is strongly recommended over the use of <body> attributes and the <font> element in HTML, because CSS is more flexible, easier to maintain and saves bandwidth. Use the CSS properties <color> and <background-color> or its shorthand <background>.

Example

The background, foreground and link colors are all specified in this simple black on white page.

html, body {
   background: #fff;
   color: #000;
}

a:link {
   background: #fff;
   color: #037;
}

a:visited {
   background: #fff;
   color: #636;
}

Further Reading

Some of the advice here differs from ours.


Valid XHTML 1.0!
Created Date: 2003-07-30 by Olivier Thereaux and Susan Lesch
Last modified $Date: 2003/09/18 16:02:36 $ by $Author: dom $

Copyright © 1999-2003 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. Your interactions with this site are in accordance with our public and Member privacy statements.