HTML Colors
Colors can be specify using <body> tag or individual tags of content using bgcolor attribute.
Color Coding in HTML
There are following methods to set colors :
By name – specify color by color names like red,blue,green.
By Hex codes – By using six-digit hexa code.
By decimal or percentage values -rgb() function is used to specified decimal or percentage values .
EXAMPLE
Set background by color name:
<!DOCTYPE >
<html>
<head>
<title>Title</title>
</head>
<body bgcolor="red">
Content Goes Here…
</body>
</html>
Hex Color Codes
In hexadecimal 6 digits are used for color representation. The first two (RR) represent a red value, the next two are a HTML Colors – Hex Codes
A hexadecimal is a 6 digit representation of a color. The first two digits(RR) represent a red value, the next two are (GG) for green value, and the last are(BB) for blue value and start with hash (#) sign.
Like : #000000,#00FF00,#0000FF,#FFFFFF
EXAMPLE
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body bgcolor="#00FF00">
<p bgcolor="#cccccc">Content Goes Here.</p>
</body>
</html>
RGB Color Codes
RGB color is specified using the rgb( ) function property. It takes three values, one for red, green, and blue. rgb() value can be an integer between 0 and 255 or can be percentage.
Like : rgb(0,0,0),rgb(255,255,0),rgb(192,192,192)
EXAMPLE
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body bgcolor="rgb(0,255,0)">
<p bgcolor="rgb(0,0,0)">Content Goes Here.</p>
</body>
</html>