B.4. background-color

Sets the background color for an element.

Note that the default background color is transparent, so even though this property is not inherited, nested elements will allow the background to show through by default. The reason for this arrangement is to allow background images to be displayed behind nested elements.

It is considered good practice always to specify a foreground color (with the color property) whenever you specify a background color, and vice versa.

Inherited: No

See also: Section B.24color

B.4.1. Value

Any CSS color value (see Appendix D) or transparent.

Initial value: transparent

B.4.2. Compatibility

CSS Version: 1

Works in all CSS-compatible browsers, including Internet Explorer 4 or later and Netscape ...

Get HTML Utopia: Designing Without Tables Using CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.