Tutorial 23: The Font of Foulness, Part II: Many Faces, Many Colors - HTML with Style | 3 | WebReference

Tutorial 23: The Font of Foulness, Part II: Many Faces, Many Colors - HTML with Style | 3

index1234

Tutorial 23: The Font of Foulness, Part II: Many Faces, Many Colors

The text color attributes to BODY

A long time ago (See, I can use that phrase without making a Star Wars reference! Oops. There I go again.) in Tutorial 1 we introduced the BODY element as the structural part of every HTML document that actually holds the document. Back in the time when the Campaign for Diseased Lilac-Colored Pages convinced Netscape to implement color in HTML, they decided to implement color as a bunch of attributes to the BODY element.

These attributes were called BGCOLOR, TEXT, LINK, VLINK and ALINK, and they eventually made their way into HTML 3.2 and HTML 4.0 Transitional. Their values are colors specified in the same hexadecimal format as the COLOR attribute to the FONT element. BGCOLOR specifies the background color for the entire document. TEXT specifies the color of the text for the entire document, and LINK, VLINK and ALINK specify the colors of text used in unvisited, visited or active links.

If you've been paying attention and remember Tutorial 5, you'll probably have figured out how these last three attributes bear a striking resemblance to the link, visited and active pseudoclasses. If we apply this knowledge to our problem of replacing these attributes with CSS, we can quickly see what we can replace the following BODY start-tag with:

<BODY
 BGCOLOR="#000000"
 TEXT="#FFFFFF"
 LINK="#0000FF"
 VLINK="#000088"
 ALINK="#FF0000"
>

Specifically, we can replace it with the following CSS ruleset, or something similar:

BODY {
 background-color: #000000;
 color: #FFFFFF;
}
A:link { color: #0000FF; }
A:visited { color: #000088; }
A:active { color: #FF0000; }

index1234

http://www.internet.com/

Legal Notices.

URL: http://www.webreference.com/html/tutorial23/2.html

Produced by Stephanos Piperoglou
Created: June 29, 2000
Revised: June 29, 2000