Beginners guide to HTML
Lesson 7 - Colours
First of All
Colours are unreliable - if you must use them, think. Some people have colours turned off.
Colours for the Whole Page
If you set colours, set all the colours. White text on a white background is
as understandable as black text on a black background. As the HTML was
written by Americans note the American spelling of color rather than colour.
Colours are set for the whole page using the <body> as follows:
<body bgcolor=bbbbb text=cccccc link=dddddd vlink=eeeeee alink=ffffff background=gggggg>
|bgcolor||Sets the Background colour for the page
|text||Sets the colour of the ordinary text
|link||Sets the colours of links
|vlink||Sets the colour for visited links
|alink||Sets the colour for active links (what is displayed between clicking on the link and it being displayed)
|background||An image for the page background (another lesson one day)
The colours can be set in two ways, by name or number. By name is simple, by
number allows very fine control of the colours.
Names: Black, Green, Silver, Lime, Gray, Olive, White, Yellow, Maroon, Navy, Red, Blue, Purple, Teal, Fuchsia and Aqua.
By number the colour should be done as text="#RRGGBB" where the RR specifies
the amount of Red, the GG the Green and the BB the Blue. The RR, GG and BB
are given in Hexadecimal ie from 00 to FF - if you don't understand use the
Text can be coloured by wrapping it in <font color=red>This is in Red</font> the colour can be named or number as above.
SOME browsers support coloured tables.
You can colour the whole table, a row or an element by adding bgcolor=bbbbbb
to any table markup in the same way as for <body>. Thus:
| Back to the index
| Previous Lesson
Updated 17th of October 2002