There are three ways to set the color of any element in HTML. 1. By color name, 2. Color with RGB value and 3 With hexadecimal value of color


1. By color name

You can color a HTML element using the color name directly. Normal colors such as black, white, red etc. Writing the color value in HTML is written directly to them. Below are the names of 16 basic color names written.

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


<title>HTML Color Tutorial </title>
<body bgcolor="red">
<p style="background:black;">welcome world</p>
<p class="colormedia">welcome</p>

2. RGB standard value

I will not advise you to use HTML rgb for secure web design because non-IE browser does not support HTML rgb. If you want to learn CSS, then you should know about this topic.

The three colors of red, green and blue are rgb. Each value is 0 (when there is no color) to 255 (when that color is full). The rgb format is RGB (RED, GREEN, BLUE).

Standard of Red, Green and Blue:


bgcolor=”rgb(255,255,255)” White
bgcolor=”rgb(255,0,0)” Red
bgcolor=”rgb(0,255,0)” Green
bgcolor=”rgb(0,0,255)” Blue