function
rgb() — CSS reference
RGB expresses gamma-encoded sRGB channels. Numeric channels use a 0–255 reference range; percentages use 0–100%. Space-separated syntax uses a slash before optional alpha. Legacy comma syntax has additional restrictions; do not mix comma and space forms arbitrarily.
Formal Syntax & Structure
css syntaxcss
rgb(R G B [ / alpha ]); legacy: rgb(R, G, B [, alpha])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:rgb(255 0 0)} #b{color:rgb(100% 0% 0% / 50%)}
</style><body><p id="a">First color sample</p><p id="b">Second color sample</p></body></html>