CSS RGB Color -
RGB stands for -
- Red
- Green
- Blue
RGB code is the combination of red green and blue colors which helps to make various new color combinations.
Syntax -
Above given formula is used to specify rgb color
Each color can go from 0 (zero) to 255 to make different combinations.
Example -
To use red color use rgb code - rgb(255,0,0)
To use green color use rgb code - rgb(0,255,0)
To use blue color use rgb code - rgb(0,0,255)
|
Now we will see list of colors and their rgb codes -
RGBA -
RGBA color values are an extension of RGB color values with an alpha value -
which specifies the opacity for a color, in other words, transparency of a color.
Syntax -
rgba(red, green, blue, alpha);
|
Example -
.apple {
/* Opaque red */
color: rgba(255, 0, 0, 1);
}
.apple-50p {
/* Half-translucent red. */
color: rgba(255, 0, 0, .5);
}
|