html tips: colors

font color
You can specify colors in HTML with certain color names, or with what's called the RGB Hex Triplet code. (RGB is for Red, Green, Blue). The next three examples show the code for specifying font colors, first with names, then with RGB Hex Triplet code.

Notice that the RGB color code renders a different color for "green" than the word does. RGB is more specific, so is preferred. Note that colors will be rendered differently on different monitors and different systems. See the RGB Hex Triplet Color Chart (68 K) on this site for more examples of codes.

page color
I've set the color of this page to be white. Page color is set in the <body> statement, like this:

text and link color
You can set your text and link colors in the <body> statement, too. Here's an example, with an explanation after it (and you can see what this code does on the example page): table colors
Table colors use the same code as you used in the <body> statement. You saw one application of this in the table above. The "header" area of that table is shaded a light grey; here's the code which sets the color for that section of the table: Here's an example of a table with colors in every section, and the full table code (minus the content in the sections) follows it: Here's the code for this table - note I've deleted the content of the table (i.e., the words "This is color 000000" which you see above):
back to
HTML Tips Articles Index

Bill Pellowe
e-mail: billp@gol.com