CSS color values is used to set the two type background color, foreground (borde-color,text-color etc.) to define a color value we some color format. You can determine your color values in different formats. Below is lists all of possible formats −
Format |
Syntax |
Example |
Short Hex Code |
#RGB |
p{color:#6A7;} |
Hex Code |
#RRGGBB |
p{color:#FF0000;} |
RGB % |
rgb(rrr%,ggg%,bbb%) |
p{color:rgb(50%,50%,50%);} |
RGB Absolute |
rgb(rrr,ggg,bbb) |
p{color:rgb(0,0,255);} |
keyword |
aqua, black, etc. |
p{color:teal;}
|
RGB % - RGB color value is the combination of RED GREEN and BLUE which is defined in percentage for example- Red color is defined as rgb(100%,50%,50%)
Hex Code - The hexadecimal color code represents a color with 6 digit number. 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). Every hexadecimal code is preceded by a pound or hash sign '#';
Example - for red we will use #FF0000
Short Hex Codes - This is the shorter form of Hex code, we use 3 digit number in this format
For red #F00
RGB - We define RBG (red, blue, green) value in a numeric format which can be an integer between 0 and 255 but some browsers does not support RGB() property.
keyword - In this format we just write a color name to define a color. like for red, red for green green
0 Comment(s)