The BODY tag attributes

The BODY tag attributes cover image
  1. Home
  2. HTML
  3. The BODY tag attributes

This session looks at some important attributes of the <BODY> tag. These attributes control the properties of the document as a whole. Some of these properties are:

The first five take hexadecimal color code or color name as their value. The last takes the URL of the image to be used.

TEXT

The color of text which is not surrounded by <A> tags is specified by this attribute. The default is black (hexadecimal code #000000).

LINK

Link color should be different from normal text color so that visitor recognizes it from its display. The default color is blue (#0000FF).

VLINK

It is good HTML practice to use a different color for visited links. This informs the visitor that the page/site has already been seen.

ALINK

This attribute specifies a color that is displayed as long as the mouse button is held pressed. On release of the mouse button, the link color will be changed to VLINK color. Since a mouse click takes almost an instant to play, this color is shown only momentarily.

BGCOLOR

Determines the background color of the document. The default is white (#FFFFFF) and you can change it to any color you want. Be sure to test this, because many a web developer has been guilty of using background colors that make it difficult to read foreground text.

BACKGROUND

Takes a URL of an image as value and puts this image as the background. Background images are tiled by browsers.

<BODY TEXT="white" LINK="red" VLINK="yellow" ALINK="green"
BGCOLOR="black">

The above code yields a page with a black background, white text, links colored red, visited links with yellow and active links green. (not a pretty sight, huh?).

The BACKGROUND attribute when used, overrides the BGCOLOR attribute. Thus, in this case, the image will form the background of the page and the background color will be ignored. If however, the image is not found, the color in BGCOLOR is used as background.

HTML