Home | Contact Us | Forums   
     
 
 
 
 

Learning the body tags.

Now that we have our first web page, lets learn something new. Lets learn how to change the look of your entire page using attributes inside the <body> tag. Below you will find the code to change your background, link colors, margins, etc.

Backgrounds
You can do two different things with your backgrounds. You can either make the background of your page an image or a set color.

To set your background to an image use this code in your body tag.

<body background="\images\background.gif">

Notice the path I have listed for my background. This represents and absolute path. The absolute path means that starting at the root of my site, first look for the directory images and then look for the image background.gif inside that directory.

If you provide an image that is not the exact size of your page when it is displayed, it will be tiled as many times as necessary to to fill the entire page with your image. This can be prevented with tables or frames, but we'll get into that later. I would recommend that if you want to use an image as a background, that you use something that can be tiled and it flow together.

If you would like to set your background to a color instead of an image, use the code below.

<body bgcolor="#000000">

The background color can equal to words also. These can be blue, black, red, white, etc. I would recommend staying away from these words and using the hexadecimal equivalent as shown above. Using words is not recognized by all browsers and does not show the same shade in all browsers. You can view my color chart you help you select a hexadecimal color for your site.

There is also another attribute that is Internet Explorer specific but neat nonetheless. This attribute makes your background stationary so it does not move as the viewer scrolls down the page. To make this happen include the code bgproperties="fixed" into the body tag.

Links
You can change the color of your links using the code shown below. All of these attributes go with the body tag.

link="#000000" - The color of a link not yet clicked.
vlink="#000000" - The color of all visited links.
alink="#000000" - The color of an active link.

Text
You can also specify the color of your text within the body tag using the following code.

text="#000000"

Now lets go to Step 4