CSS Colors
CSS color
The color code can be one of
Name format: name
When using any CSS property that accepts a color value, you have the option of providing a named color.
. Hex format: #rrggbb
A hexadecimal color is specified with: #RRGGBB, where the RR (red), GG (green) and BB (blue) hexadecimal integers specify the components of the color. All values must be between 00 and FF.
. RGB format: rgb(red, green, blue)
RGB (which stands for Red, Green, Blue) is a color model in which red, green and blue light can be added together to reproduce a color.
. RGBA format: rgba(red, green, blue, alpha)
The rgba() function works just like the rgb() function (in that it accepts the RGB value as a parameter), except rgba() accepts a fourth value — the alpha channel.
. HSL format: hsl(hue, saturation, lightness)
HSL (which stands for Hue Saturation Lightness) is a hue-based representation of the RGB color space of computer graphics.
. HSLA format: hsla(hue, saturation, lightness,alpha)
The hsla() function is based on the HSL color model. HSL (which stands for Hue Saturation Lightness) is a hue-based representation of the RGB color space of computer graphics.
Example
For blue color:
Name format: blue
Hex format: #0000FF
RGB format: rgb(0,0,255)
RGBA format:rgba(0, 0, 255, 1)
HSL format:hsl(240,100%,50%)
HSLA format:hsla(240, 100%, 50%, 1)