Page 55 - CA 165 ver 1.0 Class 10
P. 55
BGCOLOR Attribute
This attribute of <BODY> tag is used to set the background colour of the displayed screen. By default, the
background colour of the web browser is white.
Different colours can be obtained on the display screen by the combination of three basic colours namely,
red, green and blue. In HTML, each of these colours has a defined degree code that ranges from 00 (Nil)
to FF (Full) in hexadecimal form. The colour string is obtained by the combination of the code of each
colour i.e., red, green and blue, preceded by the symbol #. Syntax to use the BGCOLOR attribute is as
follows:
<BODY BGCOLOR = “COLOR NAME” or “#RRGGBB”> </BODY>
Where ‘RR’ represents the hexadecimal value of red, ‘GG’ represents the hexadecimal value of green and
‘BB’ represents the hexadecimal value of blue.
COLOR CODING
Coding of colour can be done as a combination of Red(RR), Green (GG) and Blue (BB) colour. These coding
are represented in ordered sequences of RR, GG and BB. For example: If we select a colour as Red, then
its red value is full, green value is 00 (i.e. Nil) and blue is also 00 (Nil).
Red=FF(Full) Green=00 (Nil) Blue=00 (Nil)
The resulting colour is red, so the red colour has the string (value) “#Ff0000”.
<BODY BGCOLOR =“#FF0000 ”>
RR (Red) = FF (Full)
GG (Green) = 00 (Empty)
BB (Blue) = 00 (Empty)
Similarly, if we select a color blue, then we will assign colour value as:
Red = 00 (Nil) Green=00 (Nil) Blue = FF (Full)
The table given below shows codes of different colours and their corresponding hexadecimal RGB values:
COLOUR Name HEX RGB Value COLOUR Name HEX RGB Value
Aqua # 00FFFF Black # 000000
Blue # 0000FF Grey # 808080
Green # 008000 Lime # 00FF00
Maroon # 800000 Purple # 800080
Red # FF0000 Silver # C0C0C0
White # FFFFFF Yellow # FFFF00
Introduction to HTML 53

