HTML <body> tag

The <body> tag is one of the most important tags in HTML. Within the <body> tag you specify all of the content that will appear on a page including text, links, images, form elements, audio, video, etc.

Attributes

NOTE: All of the <body> tag's attributes are deprecated. CSS should be used instead.

Attribute Possible values Description
alink colorName, hexValue, rgbValue Sets the color of active links on a page
background imageURL Sets an image as the background of a page
bgcolor colorName, hexValue, rgbValue Sets the page background color
link colorName, hexValue, rgbValue Sets the color of unvisited links on a page
text colorName, hexValue, rgbValue Sets the page text color
vlink colorName, hexValue, rgbValue Sets the color of visited links on a page

Standard attributes

class, dir, id, lang, style, title, xml:lang

For more information on standard attributes, check out our HTML standard attributes reference page.

Event attributes

onclick, ondblclick, onload, onunload, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onkeydown, onkeypress, onkeyup

For more information on event attributes, check out our HTML event attributes reference page.

Example

<html> <head> <title>Using the <body> tag</title> </head> <body> <h1>Here is some text in a big heading size</h1> <br /> Here is an image of a swan: <br /><br /> <img src="/images/swan.jpg"> </body> </html>
Output:

Here is some text in a big heading size

Here is an image of a swan: Swan

Tips & notes

Don't use the <body> tag's attributes for page styling. Use CSS instead.

Web Reference
  1. CSS reference
  2. RSS reference
  3. HTML reference


© Copyright 2011-2012 Landofcode.com
Terms of use | Privacy policy | Copyright information | Make a donation