ใช้ฟังก์ชัน CSS rgb() เพื่อกำหนดสีโดยใช้โมเดล RGB คุณสามารถลองเรียกใช้รหัสต่อไปนี้เพื่อกำหนดสีด้วยรุ่น Reg-Green-Blue (RGB)
ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
background-color:hsl(0,100%,50%);
}
h2 {
background-color:hsl(192,89%,48%);
}
p {
background-color:rgb(0,0,255);
color: rgb(255,255,255);
}
</style>
</head>
<body>
<h1>Red Background</h1>
<h2>Blue Background</h2>
<p>This is demo text!</p>
</body>
</html>