Home » Web Development » 03 - Basic HTML Tags and Style Sheets
3

Body Tag Attributes

Defining the different attributes you can use to finetune your html code

Body tag attributes allow users to fine tune the design of an HTML document by specifying background colors, images, margins and so on.

Body Tag Attribute Description
bgcolor Sets the background color of the page
text Sets the color of all text on the page
link Sets the color of links to other URLs
alink Sets the color of a link that has just been clicked on
vlink Sets the color of links already visited by the user
background Allows user to specify a background image for the page
topmargin(IE), marginheight (Netscape) Sets the top and bottom margins
leftmargin(IE), marginwidth (Netscape) Sets the left and right margins

All the color based attributes may be specified by either tying in a name if the color is a common one or a hexadecimal code that looks like this - #00000 - for mixed colors. The code of a particular color may be acquired from graphics software like Adobe Photoshop. The background image is tiled - if the image you specify is smaller than the screen, it will be repeated over and over again to fill the screen. Margin attributes may be specified in pixels. Except for the background picture and margin attributes, other attributes have been deprecated in the latest versions of HTML - meaning that a newer method that achieve the same effects is preferred to using these attributes. Let us specify a nice background image for our page. Click to download the image. Add the background markup to the florist.html file. Remember that you will have to always keep the image in the same directory as the html file for the background to appear.

<body background="flowerback.gif">
<h1>Online Florist -
<a href="http://plantanswers.tamu.edu/flowers/flower.html">Flowers</a>
For All Occasions</h1>
<br><br><br>
<hr>

<p align=justify>Hello! Welcome to your friendly neighborhood florist on the
Web. Take a look at our catalogue. You can choose from a variety of
bouquets and gifts. We have flowers to match every budget! Our flowers are
delivered fresh to your home and are payable COD.</p>

<p align=justify>If you are a new customer, take a minute to enter your
details and register with us so we know where to deliver your flowers. You
can change your contact details if you are a repeat customer. I Hope you
have a great shopping experience with us. Do keep coming back! Also, please
take a moment to give us your valuable suggestions and comments.</p>
</body>