Page Formatting

Background Images

We already learned about changing the background color. We can also use images to form our background. The way we do this is by adding some code to the the body tag. Simpy add background="image.gif" where “image.gif” is the name of the image you want to appear in the background. This image can be either a .jpg or a .gif but it must be located in the same folder as your HTML page. You can use your own image or find one in the sample-images folder in the Web Design folder. Notice that when you add a background image, it will repeat itself or “tile” to fit the entire screen. The only way to avoid tiling is to make the image so big that it won’t all show up even on the largest monitors.

Margins

Another thing you can do to modify your page is to add margins to the top, bottom, and sides so that the content of your page won’t be so close to the edges. This is the first example we’ll study where the code used is different depending on whether you’re using Netscape Navigator or Internet Explorer as a web browser. To add margins in Internet Explorer, you add this code to the body tag: leftmargin="X" topmargin="X" where X is the number of pixels of space you want between the top and bottom, and left and right edges of your page and the content. If you want to do the same thing in Netscape Navigator you would type marginwidth="X" marginheight="Y". Since you don’t know what kind of browser the person looking at your webpage will use, you should add both of these commands to the body tag.