Web Lab Documentation

RGB Color

Category:CSS Properties

RGB Color

The rgb() function specifies colors using the Red-green-blue (RGB) model. An RGB color value is specified with three parameters: rgb(red, green, blue). Each parameter defines the intensity of that color and can be an integer between 0 and 255 or a percentage value from 0% to 100%.

Examples

RGB Color

Setting the text color of a<h1> to crimson.

h1 {
  Color: rgb(220, 20, 60);
}

Syntax

rgb(red, green, blue);

Tips

  • rgb(0,0,255) value is rendered as blue.
  • rgb(255,0,0) value is rendered as red.
  • rgb(0,255,0) value is rendered as green.

Additional Information

Found a bug in the documentation? Let us know at support@code.org.