WebDevelopersNotes logo

home-icon Home / HTML / The BODY tag attributes

The BODY tag attributes

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:

  • TEXT: specifies color of normal text in a page
  • LINK: determines link color
  • VLINK: determines color of link that has been visited
  • ALINK: specifies color of link when clicked
  • BGCOLOR: controls the background color of the document
  • BACKGROUND: enables us to use an image as background for the page.

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.

Sponsored Links

Your comments
Star icon IMPORTANT Have a question / problem? Click here to ask an expert.

Sponsored Links

Tips

How do I view a deleted web page?
Is there a way to view a deleted web page - one that is no longer available? Yes there is and the solution is quite simple. [more...]

Fact

In 2000, Joseph N. Grasso had applied for the "iPod" trademark which he planned to use for Internet Kiosks. However, in 2003, he assigned it to Apple. [more...]

We use cookies to give you the best possible website experience. By using WebDevelopersNotes.com, you agree to our Privacy Policy