Global Settings with the <body> Tag

The <body> tag, originally designed to delimit the body of the document, has been extended to include controls for the backgrounds and text colors of a document. These settings are global, meaning they apply to the entire document. While these controls are currently well supported by major browsers, be aware that they have been deprecated by the HTML 4.01 specification and will eventually be phased out of use in favor of style sheet controls.

Colors

You can use the <body> tag to set colors for the document’s background and text elements (see Table 9-1). Specified link colors apply to linked text and also to the border around linked graphics. (Chapter 15 shows how to specify color in HTML.)

Table 9-1. Attributes for specifying colors with the <body> tag

Page element

HTML tag

Description

Background color

<BODY BGCOLOR=" color ">

Sets the color for the background of the entire page.

Regular text

<BODY TEXT=" color ">

Sets the color for all the regular text in the document. The default color for text is black.

Links

<BODY LINK=" color ">

Sets the color for hyperlinks. The default color for links is blue.

Visited link

<BODY VLINK=" color ">

Sets the color for links that have already been clicked. The default color for visited links is purple.

Active link

<BODY ALINK=" color ">

Sets the color for a link while it is in the process of being clicked. The default color for an active link is red.

A single <body> ...

Get Web Design in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.