The Body Tag



The body tag, < BODY >, signifies the start of the section where you will type in what will be displayed in the browsers window. The body end tag, < BODY >, signifies the end of the body of your webpage. Below, we show you the basic use of the body tag followed by its extensions used to create a background color or image for your page.

Basic Use of Body Tags

< HTML >
< HEAD >
< TITLE > Butch is the Greatest Dog < /TITLE >
</HEAD >
< BODY >
Butch is the name of my dog.
< /BODY >
< /HTML >

Try IT



Adding Background Color


In this case we can specify the background color of our webpage in the start body tag as shown below. To specify the color we choose a red, green, blue value for it. This is done via a set of three numbers. Thus, red can take on a number from 0 to 255 where 0 means no red, 255 means maximum red. The same is true for green and blue. Thus, white color = max red, max green, max blue woud be = 255, 255, 255. Black would be = no red, no green, no blue = 0, 0,0. When specifying these numbers, they are done in a format called hexadecimal: thus 0 = 00 and 255=ff. Hence white = ffffff. For more information, see p.g. 159 of the class text book .
The actual sytax of specifying a red colored page is shown below. Notice there is a # before the chain of the three hexadecimal numbers.

< HTML >
< HEAD >
< TITLE > Butch is the Greatest Dog < /TITLE >
</HEAD >
< BODY bgcolor="#ff0000" >
Butch is the name of my dog.
< /BODY >
< /HTML >

Try IT



Adding Tiled Image as Background


In this case we can specify an image to be used as the background of our webpage in the start body tag as shown below. In the text below, you must have the image saved on your machine in the same directory as the html text that refers to it. In the case below the image's filename is babybutch.jpg. For more information, see p.g. 159 of the class text book .

< HTML >
< HEAD >
< TITLE > Butch is the Greatest Dog < /TITLE >
< /HEAD >
< BODY background="babybutch.jpg" >
Butch is the name of my dog.
< /BODY >
< /HTML >

Try IT




Back