The <color>
CSS data type represents a color. A <color>
may also include an alpha-channel transparency value, indicating how the color should composite with its background.
A <color>
can be defined in any of the following ways:
- Using a keyword (such as
blue
ortransparent
). All existing keywords specify a color in the sRGB color space. - Using the RGB cubic-coordinate system (via the #-hexadecimal or the
rgb()
andrgba()
functional notations). These always specify a color in the sRGB color space. - Using the HSL cylindrical-coordinate system (via the
hsl()
andhsla()
functional notations). These always specify a color in the sRGB color space. - Using the HWB cylindrical-coordinate system (via the
hwb()
functional notation). These always specify a color in the sRGB color space. - Using the LCH cylindrical coordinate system, via the
lch()
functional notation. This can specify any visible color. - Using the Lab coordinate system, via the
lab()
functional notation. This can specify any visible color. - Using the
color()
functional notation, to specify a color in a variety of predefined or custom color spaces.
Note: This article describes the <color>
data type in detail. To learn more about using color in HTML, see Applying color to HTML elements using CSS.