rgb()
Anonymous contributor
Anonymous contributor1 total contribution
Anonymous contributor
Published Jul 21, 2021Updated Nov 14, 2023
Contribute to Docs
Defines a color by providing three comma separated values for red, green, and blue.
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(124, 124, 242);}
All contributors
- Anonymous contributorAnonymous contributor1 total contribution
- christian.dinh2476 total contributions
- Anonymous contributorAnonymous contributor3071 total contributions
- robgmerrill124 total contributions
- Anonymous contributor
- christian.dinh
- Anonymous contributor
- robgmerrill
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.