[Home]Bgcolor with bg image

HomePage | RecentChanges | Preferences | Newbie Help

HTML Basics

Why should I use a background color with my background image?

Why

Let's see what happens when one doesn't use a background color with a background image. Suppose that a background image was dark, such as a night sky with stars. The text would be a light color, such as light gray or white. Suppose that a visitor came with a slow connection. Until the background image got downloaded, the visitor would not be able to read any of the text, because the page would have a white background. He would leave pretty quickly. Also affected would be visitors with images turned off.

Therefore, the page with the black background should also have a dark background color. Visitors can read the text immediately that way.

Even if a background image is close to white, the background color should be set, because a visitor might have his browser configured to normally display a black background with white text. It is always smart to set the text color whenever the background gets set.

How

Using CSS:

 body { background: black url(stars.png); color: white; }

Using HTML 3.2:

 <body bgcolor="black" text="white" background="stars.png">

HomePage | RecentChanges | Preferences | Newbie Help
This page is read-only | View other revisions
Last edited July 23, 2002 11:27 am (diff)
Search:

This FAQ is happily hosted by Betadome Digital Media