Extensible HyperText Markup Language

XHTML.com recommends: PSD to HTML Slicing Service

background-image

Definition

The background-image property specifies the background image for an element. The screen shot below shows a paragraph with a background image.

Screen shot of a Web browser showing a paragraph of text with a repeating image behind the text.

Example

  1. p {
  2. background-image: url('/images/fox.gif');
  3. background-color: white;
  4. color: black;
  5. }

Best Practice

When setting a background image, authors should also specify a background color property that will be used when the image is unavailable. Note also that when the image is available, it is rendered on top of the background color. Thus, in any transparent areas of the image, the background color will be visible.

Characteristics

Possible values

  • A URL to an image file.
  • none
    No image is specified.
    inherit
    Use the same computed value as the parent element for this property.

Default value

none

Applies to

Inherited

No

See also