Name

background-color

Values:

<color> | transparent | inherit

Initial value:

transparent

Applies to:

All elements.

Inherited:

No.

Computed value:

As specified.

Description:

This property sets a solid color for the background of the element. This color fills the content, padding, and border areas of the element, extending to the outer edge of the element’s border. Borders that have transparent sections (such as dashed borders) will show the background color through the transparent sections.

Examples:

h4 {background-color: white;}
p {background-color: rgb(50%,50%,50%);}
pre {background-color: #FF9;}

Supported by:

Firefox, Internet Explorer, Opera, Safari.

Get CSS Pocket Reference, 3rd Edition 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.