Background Colors and Images

Using HTML you can set the background for a Web page so that it is a solid color or an image. You do this by setting an attribute in the <BODY> HTML tag. For example, to have a white background on a Web page use <BODY BGCOLOR="WHITE">. To set the background of a Web page to an image, say one that's in the file mwc.gif, use <BODY BACKGROUND="mwc.gif">. Only one of these, BGCOLOR or BACKGROUND, may be set in the <BODY> tag since either the background will be a color or an image, but not both. Setting either this way puts a background color or image on the Web page with all the other text or images displayed on top of the background.

The rules for the file name that's used with BACKGROUND are the same as for any image used in HTML. The file name can be a fully qualified URL with domain name and path, or it can be relative to the location of the file that holds the source for the Web page. Take a look at the Web page with URL http://www.webliminal.com/InternetToday/background.html to see an example.

Colors may be designated by name -- such as white, blue, or palegoldenrod, or they can be designated by a six digit hexidecimal (base sixteen) numeral. Most folks are more comfortable with the names for colors. Netscape has a guide that lists the name of 256 colors in the Web page "Color Values," http://developer.netscape.com/docs/manuals/communicator/jsguide4/colors.htm. (That's how we know palegoldenrod and papayawhip are names we can use for colors!) The six digit numeral indicates the amount of Red, Green, and Blue to be present in the color. The colors are formed in a similar way to mixing light. By that we mean that giving highest value to all three colors - designated by #FFFFFF, results in white, and least value to each - designated by #000000, results in black. The first two characters after the # represent the amount of Red, the next two of Green, and the last two of Blue. Using hexidecimal digits allows for 16 * 16 possibilities for each of the three colors and thus 166 (over 16 million) possible colors. Before you get too carried away with color possibilities remember that many people view Web pages on a monitor that may only display 256 colors. Two places to go for advice and more information about using color in Web pages are: