CSS PROPERTIES
Expand All|Collapse All
CSS AT-RULES
SPONSORED LINKS

CSS background-image Property

Topic: CSS3 Properties Reference« Prev|Next »

Description

The background-image CSS property sets the background image for an element. It is often more convenient to use the shorthand background property.

The following table summarizes the usages context and the version history of this property.

Default value: none
Applies to: All elements
Inherited: No
Animatable: No. See animatable properties.
Version: CSS 1, 2, 3

Syntax

The syntax of the property is given with:

background-image url | none | initial | inherit

The example below shows the background-image property in action.

  • body {
  •     background-image: url("images/pattern.jpg");
  • }
 

Warning:Internet Explorer 8 and earlier versions do not support the multiple background images on a single element.


Property Values

The following table describes the values of this property.

Value Description
url The location of the image resource to be used as a background image.
none The default value. If specified, no background image will be displayed.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element background-image property.

Browser Compatibility

The background-image property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 4+
  • Apple Safari 1+
  • Opera 3.5+

Further Reading

See tutorial on: CSS Background, CSS3 Background.

Related properties: background, background-attachment, background-color, background-clip, background-origin, background-position, background-repeat, background-size.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.