Extensible HyperText Markup Language

background-color

Definition

The background-color property specifies the background color of an element. The screen shot below shows an element with the background color set to red.

Screen show of a Web browser with a rectangle. The text is black on a red background color.

Background color is applied to the element's content and padding areas. The margin area is transparent. The illustration below shows the CSS box model with a background color applied.

Illustration of a CSS box model showing color applied to content and padding areas. Margin area remains transparent.

Example

  1. h1 {
  2. background-color: red;
  3. color: black;
  4. }

Characteristics

Possible values

color
Color name or value.
transparent
This keyword is used to indicate that no background color should be used for the given element, in order to allow underlying colors to shine through.
inherit
Use the same computed value as the parent element for this property.

Default value

transparent

Applies to

Inherited

No

See also

XStandard XHTML WYSIWYG editor
A standards-compliant WYSIWYG editor component for content management applications. The editor generates valid XHTML and uses CSS for formatting. Free version is available.

Check out XStandard