Colour and the body tag


© Oisin Prendiville

Over the last 2 articles I provided you with a solid base to html writing. This month I will discuss how to use colour in you html documents and the attributes of the tag.

Colours By name There are two different ways to specify a colour in a html document. The first is to use a name. There are a number of different colours that you can specify by name in a html document. A complete list of them can be found at http://www.geocities.com/~letslearnhtml/...

Hex The primary colours are red, green and blue. To create yellow you would have too combine red and green. To create magenta you would have to combine red and blue. To create aqua you would have to combine green and blue. To create white you would have to combine red, green and blue. There are 16.7 million colours that can be created by combining these three colours.

The reason there are so many is that the final colour differs depending on the amount of each colour that is used. For example if you use a certain amount of red and a certain amount of blue you will create a colour. If you double the amount of red that you used you will create a different colour.

But how do you tell the computer how much of each colour to use? You can use none of a certain colour, all of a certain colour or an amount in between. (NOTE: if you use all of every colour you will make white, if you use none of any colour you will make black). There are 256 different settings for each colour. For example you could set the red component to setting 200, the green component to setting 100, and the blue component to setting 50. This results in a dark orange colour.

Although in an image editing / creating program you specify colours in decimal. For example 34 bits of read, 67 bits of green and 123 bits of blue, where 34, 67 and 123 are all in decimal notation. On a web page you will use Hexadecimal notation. 34 becomes 22, 67 becomes 43 and 123 becomes 7B. To reference this colour in a html document you combine the three colours in order (IE: red, then green, then blue) and add a hash before it. The code for this colour would then be #22677B. This code could be used in any place where a colour is expected as a setting to attribute.

Go To Page: 1 2 3


The copyright of the article Colour and the body tag in HTML Lessons is owned by . Permission to republish Colour and the body tag in print or online must be granted by the author in writing.

Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo


Here's the follow-up discussion on this article: View all related messages

2.   Dec 12, 1998 7:21 AM
Yes you can use these names in the body tag and any other place on a page where a colour is expected.

The reason for looking up hexadecimal notation is that with hexadecimal notation there are more ...


-- posted by Oisin


1.   Dec 8, 1998 11:07 PM
Oisin - I appreciate the article, and the color chart in particular. You wrote: "There are a number of different colours that you can specify by name in a html document". Then you linked us ...

-- posted by JenL_3





For a complete listing of article comments, questions, and other discussions related to Oisin Prendiville's HTML Lessons topic, please visit the Discussions page.