Section 9.5. The Document Body


9.5. The Document Body

The body of the document comes after the document header. Although the body element markup is optional in previous versions of HTML, in XHTML it is required. The content of the body element is what gets displayed in the browser window (or read by a speech browser).

body

     <body>...</body> 

Attributes

Core attributes: id, class, style, title
Internationalization: lang, xml:lang, dir
Intrinsic Events: onload, onunload, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

Deprecated Attributes

alink="#rrggbb" or "color name"
background="URL"
bgcolor="#rrggbb" or "color name"
link="#rrggbb" or "color name"
text="#rrggbb" or "color name"
vlink="#rrggbb" or "color name"

The body element may include any combination of block-level elements, inline elements, and forms. In other words, it contains all the elements in the normal document flow. For visual browsers, the body acts as a canvas where the content appears. Audio user agents may speak the content of the body.

The HTML 3.0 Recommendation added a number of presentational attributes for the body element that had been introduced by browser developers and were in common use. At the time, they were the only mechanism for setting the color for all the links and text in the document or for adding a background color or image to the page. A single body opening tag may contain a number of specific attributes, as shown here:

     <body text="color" link="color" vlink="color" alink="color"> 

Today, of course, style sheets are the correct way to handle matters of presentation, so all of the presentational attributes for the body element are officially deprecated and are discouraged from use.

Because they are still in the Transitional DTD and universally supported in browsers, brief explanations of the deprecated body attributes are provided in Table 9-1. The CSS alternatives are provided.

Table 9-1. Deprecated body attributes

Body attribute

Description

Equivalent CSS style

text="color"

Sets the color for all the regular text in the document

body {color: color}

link="color"

Sets the color for hyperlinks

a:link {color: color}

vlink="color"

Sets the color for links that have already been clicked

a:visited {color: color}

alink="color"

Sets the color for a link while it is in the process of being clicked

a:active {color: color}

bgcolor="color"

Sets the color of the background for the entire page

body {background-color: color}

background="url"

Specifies an image to be used as a tiling background for the page

body {background-image: url(filename.gif)}





Web Design in a Nutshell
Web Design in a Nutshell: A Desktop Quick Reference (In a Nutshell (OReilly))
ISBN: 0596009879
EAN: 2147483647
Year: 2006
Pages: 325

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net