Share this Page URL

Chapter 6. A Picture Is Worth a Thousand... > Giving a GIF a Transparent Backgroun... - Pg. 71

A Picture Is Worth a Thousand Clicks: Working with Images 71 Yes, you're right: The rrggbb part is the same color code that I talked about back in Chapter 3, "From Buck-Naked to Beautiful: Dressing Up Your Page." Figure 6.5 shows an example page that uses a black background (see blakback.htm on this book's CD). Note, too, that I had to use white for the page text so the surfer can read the page (which is kind of important). Using an Image as the Background Instead of a color, you can specify an image to use as the background (similar to the way Windows and the Mac let you cover the desktop with wallpaper). This doesn't have to be (nor should it be) a large image. The browser takes smaller graphics and tiles them so they fill up the entire window. The secret to background images is the <BODY> tag's BACKGROUND attribute: <BODY BACKGROUND="filename"> Here, filename is the name of the graphics file you want to use. In general, I recommend sticking with just a different background color. Tiled background images take longer to load, and they can make text devilishly difficult to read. If you really want to use a background image, then I suggest you also use the BGCOLOR attribute and set it equal to a color that more or less approximates the background color of the image. This will make your page look a bit nicer while it's loading. Webmaster Wisdom