Colour

Colour can be used for background and text.

Attribute: bgcolour; this is what you type in tags to change the colour of the background.

You specify the colour either by using a predefined list of named colours, or by the use of numbers (hexadecmial).
The way you write this in HTML is:
< body bgcolor="colour" >
colour stands for the colour that you want to use for the background.

To change the colour of text in a document use:
< body text="colour" >
Again where colour stands for the colour that you want to use.
The same statment can be used to change the colour of the links in the document:
< body link="colour" >

The method above shows how to change the colour of the whole document, but if you want to change a single word or line another code is needed at the place of the words you want to change the colour of:
< b > < font color="red" > this is the colour change < font > < /b >.


This is a list of predefined colours:-
Black Silver White Gray
Red Fuchsia Maroon Purple
Blue Navy Aqua Teal
Lime Green Yellow Olive

The other way to choose what colour to use is the numbering system. Colours are the amount of red, green and blue light. On a computer this is specified by a number, 0 to 255 for each of the colours. For example (0,0,0) is black as there is no colour, whereas (255,255,255) is white, as all colours mixed together are white.
The order of the brackets is always RED, GREEN, BLUE. This produces the commonly used term RGB. So:


(255,0,0) = intense red

(0,255,0) = intense green

(0,0,255) = intense blue


The original choice of red, green and blue was due to the fact that human eyes pick up these colours best.


These are the values that a computer uses to choose colours, however when we want to type them in to the computer we have to use a different system called Hexadecimal.
Hex is a base-16 number system. This is a combination of numbers from 0-9 and letters from A-F. Any combination of these avaliable symbols will produce an amount of colour for each red, green and blue.
00 represents the smallest amount of intensity, i.e. 0 out of 255,
FF represents the largest amount of intensity, i.e. 255 out of 255
these are expressed in HTML as:


#FF0000 = intense red

#00FF00 = intense green

#0000FF = intense blue

we must use the number symbol "#" so that the computer know the next 6 digits represent a hex number.

This is the complete table of conversion from hexadecimal to RGB numbering.

Hexidecimal Digit Equivalents
Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
2 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
3 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
4 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
5 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
6 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
7 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
8 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
9 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
A 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
B 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
C 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
D 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
E 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
F 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 225




This is the end of this section, you can continue to the next section or try the exam to test your knowledge.
Click here to attempt the exam now.



Previous Page

Next Page

Go to top