HTML Colors

The HTML color codes are ways of representing the colors we see everyday in a format that a computer can interpret and display. Commonly used in websites and other software applications. Colors are very important to give a good look and feel to the websites. We can specify colors on page level using <body> tag or you can set colors for individual tags using bgcolor attribute. HTML colors are specified using predefined color names, or RGB, HEX, HSL, RGBA, HSLA values.

HTML Color Names :

With HTML color names we can specify direct a color name to set text or background color. W3C has listed 16 basic color names that will validate with an HTML validator but there are over 200 different color names supported by major browsers.

W3C Standard 16 Colors :

Black Gray
Silver White
Yellow Lime
Aqua Fuchsia
Red Green
Blue Purple
Maroon Olive
Navy Teal

You can find the full color list here :

Hex color codes :

A hexadecimal is a 6 digit representation of a color. The first two digits(RR) represent a red value, the next two are a green value(GG), and the last are the blue value(BB).


The hexadecimal values between 00 and ff (same as decimal 0 to 255). Each hexadecimal code will be preceded by a pound or hash sign #. Following is a list of few colors using hexadecimal notation. For example, #ff0000 is displayed as red, because red is set to its highest value (ff) and the others are set to the lowest value (00).

#ff0000 #0000ff
#3cb371 #ee82ee
#ffa500 #6a5acd
#000000 #3c3c3c
#787878 #b4b4b4

You can find the full hex color list here :

RGB Color values :

In HTML, a color can be specified as an RGB value, using this formula :

rgb(red, green, blue)

In this color value is specified using the rgb( ) property. This property takes three values, one each for red, green, and blue. The value can be an integer between 0 and 255 or a percentage.

rgb(255, 0, 0) rgb(0, 0, 255)
rgb(60, 179, 113) rgb(238, 130, 238)
rgb(255, 165, 0) rgb(106, 90, 205)
rgb(0, 0, 0) rgb(60, 60, 60)
rgb(120, 120, 120) rgb(180, 180, 180)

You can find the rgb color list here :

Next Topic :