CSS supports various color formats to specify colors for elements.
CSS provides a set of predefined color keywords.
color: white; background-color: blue;
color: #ffffff; /* White */ background-color: #0000ff; /* Blue */
Hexadecimal notation represents colors using six hexadecimal digits, where pairs of digits represent the intensity of red, green, and blue (RGB) components.
color: rgb(255, 255, 255); /* White */ background-color: rgb(0, 0, 255); /* Blue */
color: rgba(0, 0, 0, 0.5); /* Black with 50% transparency */ background-color: rgba(0, 0, 255, 0.2); /* Blue with 20% transparency */
RGB (Red, Green, Blue) notation specifies colors using the intensity of each of the three primary colors.
color: tomato; background-color: azure;
color: hsl(0, 100%, 50%); /* Red */ background-color: hsl(240, 100%, 50%); /* Blue */
RGBA is similar to RGB, but includes an alpha channel for transparency.
CSS provides a set of named colors that can be used directly.
HSL (Hue, Saturation, Lightness) notation defines colors based on their hue, saturation, and lightness.