Abundant Technologies - IT Consulting Experts

 Source Code Library

 Code Details

Color C   A   S   C   A   D   I   N   G     S   T   Y   L   E     S   H   E   E   T     D   O   C   U   M   E   N   T   A   T   I   O   N

author's guide to

b l u e

r e d

g r e e n




Style Sheets and Color

You can set colors in your HTML document by using the color attributes of the BODY, FONT, HR, MARQUEE, and TABLE elements. For example, you can set background color for your document by using the BGCOLOR= attribute with the BODY element as in the following example:
<P>This page has a white background.

Named Colors

You can specify colors in two ways: by using a color name (as in the example above), or by using numbers to denote a red-green-blue color value. Internet Explorer supports these color names: AQUA, BLACK, BLUE, FUCHSIA, GRAY, GREEN, LIME, MAROON NAVY, OLIVE, PURPLE, RED SILVER, TEAL, WHITE, YELLOW.
These colors display as:


Note: This feature is not compatible with Netscape v2.0.

Hexadecimal Specification

A red-green-blue color value consists of three two-digit hexadecimal numbers, with each number specifying the intensity of the corresponding color. For example, the color value #FF0000 is red because the red number is set to its highest value, FF (255 in the decimal, or base 10, system). Green and blue are set to zero. Similarly, #00FF00 is green and #0000FF is blue. The pound sign (#) is optional. In this example, a red horizontal rule is displayed by the following HTML code:
<HR COLOR="#00FF0000"> 

A Word of Caution

Although red-green-blue color values theoretically allow for many thousands of colors, the actual number of colors available for your HTML document depends on the color capabilities of the devices the document will be viewed on. Many personal computers can display only 16 colors due to the type of video display adapter they use. Always choose colors carefully, and whenever possible test your color choices on a variety of computers.

Mail To: info@3pc.com