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 will apply to the entire document.

Colors

You can use the <body> tag to set colors for the background and text elements (see Table 6.1). Specified link colors apply to linked text, but also to the border around linked graphics. (To learn how to specify color in HTML, see Chapter 5.)

Table 6-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> tag can contain a number of specific attributes, as shown here:

<BODY BGCOLOR="color" TEXT="color" LINK="color" VLINK="color" ALINK="color">

Tiling Background Graphics

You’ve probably seen web pages that have a graphic image repeating ...

Get Web Design in a Nutshell 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.