CSS Color Values
CSS supports many ways to express colour. Choosing the right format affects readability, maintainability, and the colour space you are working in.
Named Colors
CSS defines 148 named colours, from red and blue to rebeccapurple and cornsilk. They are convenient for quick prototyping.
Hexadecimal
Six-digit hex codes (#RRGGBB) encode red, green, and blue channels as pairs of hex digits (00–FF). A shorthand three-digit form (#RGB) doubles each digit. An optional two-digit alpha suffix gives eight-digit hex (#RRGGBBAA).
RGB / RGBA
rgb(255 99 71) uses modern space-separated syntax. Add a slash and alpha: rgb(255 99 71 / 0.6).
HSL / HSLA
hsl(hue deg, saturation%, lightness%) is human-readable. Adjusting only the lightness creates tints and shades of the same hue.