In HTML a color can be specified by using :
Color Name ex. Green.
RGB Value ex. rgb(0,255,0).
HEX Value ex. #fff.
In this method set color using it's name like red,green and other color the following simple syntax of using color name
<h2 style="background-color:red;">This Color By Name - Red</h2>
<h2 style="background-color:green;">This Color By Name - Green</h2>
Color |
Name |
---|---|
Orange |
|
Red |
|
Green |
|
Yellow |
|
Blue |
In this method set color using it's rgb value like rgb(0,255,0) and other color rgb value the following simple syntax of using color rgb value.
<h2 style="background-color:rgb(255,0,0);">This Color</h2>
<h2 style="background-color:rgb(255,140,0);">This Color</h2>
Color |
Name |
---|---|
rgb(255,140,0) |
|
rgb(255,0,0) |
|
rgb(0,128,0) |
|
rgb(255,255,0) |
|
rgb(0,0,255) |
In this method set color using it's HEX value like #FFF and other color HEX value the following simple syntax of using color HEX value.
<h2 style="background-color:#FF8C00;">This Color</h2>
<h2 style="background-color:#FF0000;">This Color</h2>
Color |
Name |
---|---|
#FF8C00 |
|
#FF0000 |
|
#008000 |
|
#FFFF00 |
|
#0000FF |