Search within TutorialsPark

CSS background-color Property

To set the background Color of the Element.

Definition and Notes.

1. The CSS background-color property is used to add a color to the background of an element.

2. The background is placed underneath the border and background-image, for non-solid border-styles like dashed or dotted the background color is visible through the gaps between the dots and the dashes.

3. An elements background includes the padding and the border but not the margin. And by default the background is transparent and the background of the parent element is visible


CSS background-color property. internetexplorer safari firefox opera chrome

View in Splitscreen»


Note-You can use a color value or the keyword 'transparent', to make the inderneath colors shine through.


Value Description
color To set a background color using HEX codes or RGBa or HSLa colors.
transparent To make the background transparent, such that the background of the parent element is visible.
inherit The Background color is inherited from the parent element.


Specs Value
Name background-color
Value <color> | transparent | inherit
Initial Value transparent.
Applies to all elements.
Javascript syntax"#000"
Inherited No
Browser Support internetexplorer safari firefox opera chrome

Related Examples.