C & G web

Body Element Attributes

The BODY tag contains the actual contents of the document. That contents should consist of block elements only. You may put in plain text in the body, this is then assumed to be inside a P container.

The attributes contain the appearance of the document. The BACKGROUND attribute should point to the location of an image, which is used as the (tiled) background of the document. The other attributes set the colors for the background, text, links, visited links and active (currently being selected) links, using the order above.

The colour is composed by specifying the red, green and blue components of the color in hexadecimal notation, with a # in front. For example, to specify white, the red, green and blue components are 255, 255, 255, so you would use "#FFFFFF". You can also use the following color names, although they are not as widely supported as the codes:

Black: #000000 Green: #008000 Silver: #C0C0C0 Lime: #00FF00
Gray: #808080 Olive: #808000 White: #FFFFFF Yellow: #FFFF00
Maroon: #800000 Navy: #000080 Red: #FF0000 Blue: #0000FF
Purple: #800080 Teal: #008080 Fuchsia: #FF00FF Aqua: #00FFFF


Example - Body Element Attributes

The background colour of a web page can be changed using the bgcolor Attribute of the body Element.

The text colour of a web page can be changed using the text Attribute of the body Element.

The HTML

<html>
<head>
	<title>Body Element Attributes</title>
</head>

<body bgcolor="Silver" text="Blue">

The background colour of a web page can be changed using the <b>bgcolor</b>
Attribute of the <b>body</b> Element.

<p>The text colour of a web page can be changed using the <b>text</b> Attribute of the
<b>body</b> Element.
</body>
</html>

Important - the spellings in HTML are American (US). For example it is 'BGCOLOR' not bgcolour.

For more information on colours click here.

Previous page...

Back to Top of Page

Computeach International Ltd

Christopher Ward London Limited

Christopher Ward London Limited