rgb()
Published Jul 21, 2021Updated Sep 3, 2021
Contribute to Docs
Defines the color value by providing three comma separated values. The first value represents the red value, the second represents the green value, and the third represents the blue value.
Syntax
<property>: rbg(red, green, blue);
where red
, green
, blue
can be one of the following:
- Number values: ranging between
0
and255
- Percentage values: ranging between
0%
and100%
Example 1
Set the font color of the h1
element to be white:
h1 {color: rgb(255, 255, 255);}
Example 2
Set the font color of the h1
element to be black:
h1 {color: rgb(0, 0, 0);}
Example 3
Set the font color of the h1
element to be a lavender color:
h1 {color: rgb(230, 230, 250);}
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.