71 of 313 menu

The background-color property

The background-color property sets a background color of an element. The property value is any color units. Default value: transparent.

Syntax

selector { background-color: color; }

Example

Let's give the block some background color:

<div id="elem"></div> #elem { background-color: #9595ff; width: 300px; height: 100px; }

:

See also

  • the background property
    that is a shorthand property for a background
  • the background-image property
    with that you can set a background image for a block
byenru