Specifying Colours

The following attributes can be used to modify the <body> tag. They control how the page will look.

text="#000000"

This sets the colour for the text in the main body of the document. If omitted the colour will the default colour for the browser, usually black.

In this example the colour is specified in hexadecimal code; see the page on colour for an explanation. You can then alter the colour of text on a case-by-case basis with additional formatting.

link="#0000ff"

This sets the colour that will highlight the hyperlinks, in this case blue.

vlink="#800080"

This sets the colour that will highlight a hyperlink that has already been visited, purple.

alink="#ff00ff"

This sets the colour that will highlight an active hyperlink, fuchsia.

bgcolor="#ffffff"

This sets the background colour of the page,  white .

background="image.gif"

Instead of a plain background you can choose an image for the background, image.gif is the name of the image file.

If the dimensions of the image file are smaller than the web page the image will be tiled, that is; repeated so that if fills the background.

The <body> tag for a typical page might look like this:

<body link="#0000ff" vlink="#800080" background="image.gif">

The values for link, vlink and background are enclosed in quotation marks. It is good practice to get used to doing this although it is only essential when the value contains spaces. Notice that where no colour is specified (e.g. for alink and bgcolor) the browser default colours will be used.