The rgb
function creates a color with red, green, and blue values.
This function can be used by any property that requires a color value.
An element with an rgb background-color.
<style>
.rgb {
padding: 25px;
background-color: rgb(230, 230, 250);
}
</style>
<div class="rgb">An rgb background color</div>
The rgb
function defines a color with red, green, and blue values.
The color intensity ranges from 0 to 255 or 0% to 100%.
Rgb can be used for any property that requires a color value.
rgb(red, blue, green);
Value | Description |
---|---|
red |
Red color intensity, from 0 to 255 or 0% to 100%. |
blue |
Blue color intensity, from 0 to 255 or 0% to 100%. |
green |
Green color intensity, from 0 to 255 or 0% to 100%. |
This table shows when rgb
support started for each browser.
![]() Chrome
|
1.0 | Dec 2008 |
![]() Firefox
|
1.0 | Nov 2004 |
![]() IE/Edge
|
4.0 | Sep 1997 |
![]() Opera
|
3.5 | Nov 1998 |
![]() Safari
|
1.0 | Jun 2003 |