Archive for March, 2010

Colors in HTML

Friday, March 5th, 2010

Colors are displayed combining RED, GREEN, and BLUE light.



<html>
<body>

<p style=”background-color:#FFFF00″>
Color set by using hex value
</p>

<p style=”background-color:rgb(255,255,0)”>
Color set by using rgb value
</p>

<p style=”background-color:yellow”>
Color set by using color name
</p>

</body>
</html>

The Output:

Color set by using hex value

Color set by using rgb value

Color set by using color name

Color set by using hex value

Color set by using rgb value

Color set by using color name

Values  of  Colors:

HTML colors are defined using a hexadecimal (hex) notation for the combination of Red, Green, and Blue color values (RGB).

The lowest value that can be given to one of the light sources is 0 (hex 00). The highest value is 255 (hex FF).

Hex values are written as 3 double digit numbers, starting with a # sign.

Color Values:

Color Color HEX Color RGB
#000000 rgb(0,0,0)
#FF0000 rgb(255,0,0)
#00FF00 rgb(0,255,0)
#0000FF rgb(0,0,255)
#FFFF00 rgb(255,255,0)
#00FFFF rgb(0,255,255)
#FF00FF rgb(255,0,255)
#C0C0C0 rgb(192,192,192)
#FFFFFF rgb(255,255,255)