g
Printer Friendly Version

editor  
BellaOnline's HTML Editor
 

HTML Fundamentals - The Body Tag

HTML pages are divided into two main sections: the head area, and the body area. The body section is where all the ‘visible’ goodies go. This is the part of the page that your visitors actually see, so it’s important to get it right.

The body tag acts as a container for everything within the body section. It will look something like this:

<body>
Assorted HTML code goes here...
...
...
</body>

As with most HTML tags, you can add attributes that affect how everything within that tag looks. Since the body tag holds all of that page’s visible items, changing the body tag’s attributes will affect the entire page.

Note that all of the body tag attributes are now deprecated! If you want to change your page’s appearance, use CSS; it’s the approved way to format a webpage, and it has a great deal more flexibility and far more options for the website designer. Nonetheless, for a complete understanding of HTML you should be familiar with the body tag’s attributes – for one thing, you might come across a webpage one day that still uses them, and you’ll know how to fix it!

Without further ado, here are the body tag attribute options:

link: Sets the text color for all links throughout the page. You can either use one of the named colors, or specify a shade using hexadecimal code.

alink: Sets the color for active links on the webpage.

vlink: Sets the color for previously visited links.

text: Sets the color for all text on the page.

background: Lists an image file to use as the page’s background.

bgcolor: Specifies the page’s background color.

If you were to use these attributes, the body tag would look something like this:

<body text ="purple" alink="yellow" vlink="red" bgcolor="green" background="image.gif">
Assorted HTML code...
...
...
</body>

Be careful when setting the background attribute to list the image's file path correctly. If your image is in the same folder as your webpage, all you need to do is list the image name. Otherwise, you need to direct the browser to the proper folder on your server. If you're in doubt, it's best to use an absolute url (which looks something like 'http://www.domain.com/images/image.gif') so that it'll work correctly regardless of where the page is located.

This site needs an editor - click to learn more!

HTML Site @ BellaOnline
View This Article in Regular Layout

Content copyright © 2013 by Elizabeth Connick. All rights reserved.
This content was written by Elizabeth Connick. If you wish to use this content in any manner, you need written permission. Contact Editor Wanted for details.



| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2023 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor