« CSS « CSS Reference


The background-color CSS property sets the background color of an element, either through a color value or the keyword transparent.


background-color: color | inherit


Is a CSS <color> that describes the uniform color of the background. Even if one or several background-image are defined, this color can be affect the rendering, by transparency if the images aren't opaque.


View Live Examples

.exampleOne {
	background-color: teal;
	color: white;

.exampleTwo {
	background-color: rgb(153,102,153);
	color: rgb(255,255,204);

.exampleThree {
	background-color: #666699;
	color: #FFFFFF;


Specification Status Comment
CSS Backgrounds and Borders Module Level 3 Candidate Recommendation Though technically removing the transparent keyword, this doesn't change anything as it has been incorporated as a true <color>
CSS 2.1 Recommendation  
CSS 1 Recommendation  

Browser compatibility

  • Desktop
  • Mobile

Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari (WebKit)
Basic support 1.0 (1.7 or earlier) 1.0 4.0 3.5 1.0 (85)
Feature Firefox Mobile (Gecko) Android IE Phone Opera Mobile Safari Mobile
Basic support 1.0 (1.9.2) (Yes) (Yes) (Yes) (Yes)

Tags (2)

Edit tags

Attachments (0)


Attach file