data-type

<color> — CSS reference

The color data type represents a color and its opacity. Properties such as color and background-color accept it, but the type is not itself a property. Many syntaxes express identical colors, and some use color spaces wider than sRGB. Missing components, contextual keywords and interpolation have their own rules.

Formal Syntax & Structure

css syntaxcss
<color> (representative forms: named keyword | hex notation | color function)

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS color lab</title><style>body {margin:0} .sample {height:12px;background:#006050}p {padding:12px;background:white;color:black;border:2px solid currentColor} #a{color:red} #b{color:rgb(255 0 0)}
</style><body><p id="a">First color sample</p><p id="b">Second color sample</p></body></html>
CSS Reference