Authoring   HTML Basics
Background Images

<body background=?> sets the background image

The <body background> tag allows you to use an image file for the background of your Web page. A large image may only appear once (depending on the size of the browser window), but smaller images will be redrawn as many times as necessary to fill a page - a process known as tiling.

If you write in your HTML doc:

<body background="kitty.gif">

Then kitty will appear in your background as many times as the browser window and the size of your image will allow. If, for instance, it's a small image - say, 20 by 20 pixels - and the page is being viewed in a 480 by 640 browser window, then kitty would appear an astounding 768 times.

Keep in mind that there's no way to prevent a background image from tiling. So if you want to make sure it doesn't, you'll have to make the image wide enough and tall enough to accommodate large monitors.

On this example page, for instance, we wanted our background image to create a stripe down the left-hand side, and we wanted the image file to be as small as possible. However, we didn't want more than one stripe to appear, no matter how wide the monitor is (in other words, we wanted the image to tile vertically, but not horizontally). To accomplish this, we created a short, wide, striped image - 1,200 by 24 pixels - that looks something like this (only larger):

[Background

image - only smaller]

That way, someone would need a browser window at least 1201 pixels - or just under 17 inches - wide to see a second stripe, but the image size is still quite small (25K). Note that the pixel-to-inch ratio is adjustable, and varies from platform to platform; 72 pixels per inch is standard, since it corresponds with the typographic rule of 72 "points" per inch.

Note: Almost the whole browser gang supports background images (including Netscape 1.1 and later, and all versions of Internet Explorer). Only older versions of NCSA Mosaic and the AOL browser will turn down your background image. yourself.