HTML5 Reference – Colors


What is HTML colors ?

HTML Colors are very important part in the webpage designing.

It gives the good look and feel to our website.

Colors are usually implemented inside the <body></body> tag.

Attributes in <body> tag to set colors

There are various attributes used to set colors inside the <body></body> tag, some of them are listed below,

1. bgcolor

        This sets a color for the background of the page.

2. text

        This sets a color for the body text.

3. alink

        This sets a color for active links or selected links.

4. link

        This sets a color for linked text.

5. vlink


        This sets a color for visited links(this sets the color for already clicked on).

HTML coding for a website !!!

Click to Learn More about – HTML Tutorial for beginners

How to set the Color Coding in HTML webpage ?

There are three different methods used to set colors in our web page.

1. Color names

2. Hex codes

3. Color decimal or percentage values

1. Color names

We can specify color names directly like green, blue or red.

HTML can recognize 16 color names (“black”, “white”, “gray”, “silver”, “maroon”, “red”, “purple”, “fushsia”, “green”, “lime”, “olive”, “yellow”, “navy”, “blue”, “teal”, and “aqua”).

But there are over 200 different color names supported by major browsers.


2. Hex codes

A six-digit code representing the amount of red, green, and blue that makes up the 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).

Each hexadecimal color code will be preceded by a pound or hash sign #.

3. Color decimal or percentage values

This value is specified using the rgb( ) property.

rgb() property takes three values, one each for red, green, and blue.

The value can be an integer between 0 and 255 or a percentage.

HTML Color Codes :