代码示例:(标识:cssref_color_rgb)
<!DOCTYPE html>
<html>
<head>
<style>
#p1 {background-color:rgb(255,0,0);}
#p2 {background-color:rgb(0,255,0);}
#p3 {background-color:rgb(0,0,255);}
#p4 {background-color:rgb(192,192,192);}
#p5 {background-color:rgb(255,255,0);}
#p6 {background-color:rgb(255,0,255);}
</style>
</head>
<body>

<h1>RGB 颜色</h1>
<p>RGB 颜色值通过 rgb() 函数来规定:rgb(red, green, blue)</p>
<p>每个参数(红色,绿色和蓝色)定义颜色的强度,并且可以是 0 到 255 之间的整数或百分比值(从 0% 到 100%)。</p>

<p id="p1">红色</p>
<p id="p2">绿色</p>
<p id="p3">蓝色</p>
<p id="p4">灰色</p>
<p id="p5">黄色</p>
<p id="p6">樱桃色</p>

</body>
</html>
运行结果: