background-color

Specifies the background color of an element. Although this property does not inherit properties from its parent, because the initial value is set to transparent, the background color of the child elements is the same as the background color of the parent element.

Syntax



background-color: color | transparent | inherit


color - Color can be set in three ways.
1. By its name. For example: red, gray, blue and other.
2. By hexadecimal value. For example: #FA8072, #CD5C5C, #A52A2A and other.
3. Using RGB. For example: (128,0,0), (139,0,0), (165,42,42) and other.

transparent - Sets a transparent background.

inherit - Inherits the value of the parent.