Background Color

Category:CSS Properties

Background Color

The background-color property specifies the background color of an element. Color values can be defined with HEX, RGB, or color name.


Background Color in Hex

Setting the background color with a HEX value.

body {
  background-color: #92a8d1;

Background with Color Names

Setting the background with a color Name.

body {
  background-color: blue;

Background Color in RGB

Setting the background color with an RGB value.

body {
  background-color: rgb(100, 70, 200);


background-color: value;


  • The default background color is transparent.
  • The background of an element is the total size of the element, including padding and border (but not the margin).
  • Use a background color and a text color that makes the text readable.

Additional Information

For more information, see

Found a bug in the documentation? Let us know at