Syntax | selector {background-color: value;}
|
---|---|
Usage | The background-color property is used to specify the element's background color. This property is specified by using a color-value, or a keyword, according to the syntax shown above. CSS Example: The background-color property is set using the keyword yellow. h1 {background-color: yellow;} CSS Example: The background-color property is set using a RGB 6-Digit Hexadecimal value of #ffa500. h1 {background-color: #ffa500;} CSS Example: The background-color property is set using a RGB Percentage Functional Notation value of rgb(30%,50%,70%). h1 {background-color: rgb(30%,50%,70%);} |
Keywords |
|
Applies To | All elements |
Inherited | No |
Initial Value | transparent |
The background-color property is set using the keyword yellow. The background-color property is set using a RGB 6-Digit Hexadecimal value of #ffa500. The background-color property is set using a RGB Percentage Functional Notation value of rgb(30%,50%,70%). The background-color property is set using the keyword transparent. |