Login for Software or Support

CoffeeCup - HTML Editor, Flash & Web Design Software

Over 48,871,552 Downloads in 87 Countries

Tell a Friend About Our Cool Software

Buy the Book Here !

Chapter 3: HTML and Colors


HTML provides you with control over the colors of items on your pages. There are two ways to specify a color.

The first and easiest is to simply use the color name. You can select from the following 16 keywords: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow. Of course you can use this technique only if you want one of these colors.

The second way, which allows specifying any color you want, is using Hex Codes. This is the preferred way to specify colors because it is universally understood and you'll never get stuck trying to find the name for that certain shade of blue.

To use this technique you need to understand how colors on a computer screen are created. Any color is a combination of the three additive primary colors red, green, and blue. This is why you will sometimes see computer colors referred to as RGB colors. In any given color, each of the three primary colors has a value ranging from 0 (none) to 255 (maximum), so any color can be represented by its RGB value of three numbers--and this is how you can specify colors for your Web page elements. There are three formats for doing this:

  • Use the rgb(r, g, b) function where r, g, and b are numbers in the range 0-255 specifying the level of that primary color.
  • Use the rgb(r%, g%, b%) function where r, g, and b are numbers in the range 0-100 specifying the level of that primary as a percentage of maximum.
  • Use a hexadecimal (base 16) number in the form #RRGGBB where RR, GG, and BB are each a hexadecimal number in the range 00-FF (0-255 in decimal notation).

Table 3-1 shows some examples of colors using the rgb() function and hexadecimal notation. You can experiment with colors using your HTML editor and browser to see what different values look like.

Table 3-1. RGB and hexadecimal codes for some colors.

 Color  rgb()  Hexadecimal
 Black  rgb(0,0,0)  #000000
 White  rgb(255,255,255)  #FFFFFF
 Medium gray  rgb(153,153,153)  #999999
 Blue  rgb(0,0,255)  #0000FF
 Red  rgb(255,0,0)  #FF0000
 Green  rgb(0,255,0)  #00FF00
 Yellow  rgb(255,255,0)  #FFFF00
 Purple  rgb(255,0,255)  #FF00FF
 Light blue  rgb(51,255,255)  #33FFFF
 Pink  rgb(255,51,153)  #FF3399
 Brown  rgb(153,51,0)  #993300
A full list of HTML Color Codes can be found at http://html-color-codes.com/


Table of Contents
Download Our Software:

... and don't forget about our Free Software

CoffeeCup Home Page | Software | Copyright & Legal | Site Map | © 1996 - 2008 CoffeeCup Software, Inc.