The color of the background is defined with the property simply called background-color.

As other color related properties (i.e. color) color may be described in few possible ways; that is as one of 16 pre-defined names, as RGB decimal numbers or a "hash (#)" delimited hexadecimal numbers.

The background-color property contains following information:

  1. value: <color>, transparent or inherit;
  2. initial: transparent;
  3. applies to: all elements;
  4. inherited: no;
  5. percentages: N/A;
  6. media: visual;
  7. computed value: as specified.

The value color sets a color of an element. If the value is not explicitly assigned or it is set as transparent the element's color will be the same as its parent (due the transparency effect).

Learn more about the color data type!


CSS background-color property example:


›› go to examples ››