Earn income with your CSS skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest self-service freelancing marketplace for people like you.

CSS rgb() Function

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.

Example

#

An element with an rgb background-color.

An rgb background color
<style>
  .rgb {
    padding: 25px;
    background-color: rgb(230, 230, 250);
  }
</style>

<div class="rgb">An rgb background color</div>

Using rgb

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.

Syntax

rgb(red, blue, green);

Values

#

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%.

Browser support

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

You may also like

Earn income with your CSS skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest self-service freelancing marketplace for people like you.

Guides