Easy Tutorial
❮ Pr Dim Line Height Sel Hover ❯

CSS rgb() Function

CSS Functions

Example

Using RGB colors:

#p1 {background-color:rgb(255,0,0);} /* Red */
#p2 {background-color:rgb(0,255,0);} /* Green */
#p3 {background-color:rgb(0,0,255);} /* Blue */

Definition and Usage

The rgb() function uses the combination of Red(R), Green(G), and Blue(B) colors to create various colors.

RGB stands for Red, Green, and Blue.

Version Supported: CSS2


Browser Support

The numbers in the table specify the first browser version that fully supports the function.

Function
rgb() 1.0 4.0 1.0 1.0 3.5

CSS Syntax

rgb(red, green, blue)
Value Description
red Defines the red value, range 0 to 255, or a percentage from 0% to 100%.
green Defines the green value, range 0 to 255, or a percentage from 0% to 100%.
blue Defines the blue value, range 0 to 255, or a percentage from 0% to 100%.

CSS Functions

❮ Pr Dim Line Height Sel Hover ❯