Visit Mozilla.org

CSS:background-color

From MDC

« CSS Reference

[edit] Summary

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

[edit] Syntax

background-color: color | transparent | inherit

[edit] Values

color 
The color can be specified as a hexidecimal RGB value, a regular RGB value, or by using one of the pre-defined color keywords.
transparent 
The default value for background-color is transparent meaning the element has no color of its own, instead showing the color of the element behind it.

[edit] Examples

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;
}

[edit] Notes

(Add links to good colour reference sites here.)

[edit] Specifications

[edit] Browser Compatibility

TBD: This may be removed in favour of a centralized compatibility chart.

[edit] See Also

background, background-attachment, background-color, background-image, background-position, background-repeat