background-image property CSS Reference

Definition and Usage

The CSS background-image property sets one or several background images for an element. The images are drawn on successive stacking context layers, with the first specified being drawn as if it is the closest to the user. The borders of the element are then drawn on top of them, and the background-color is drawn beneath them.

How the images are drawn relative to the box and its borders is defined by the background-clip and background-origin CSS properties.

If a specified image cannot be drawn (for example when the file denoted by the specified URI cannot be loaded), browsers handle them as if it was the none value.

Note: Web developers should always specify a background-color, even if the images are opaque and the color won't be displayed in normal circumstances; if the images cannot be loaded - for instance, when the network is down - the background color will be used as a fallback.

  • Initial none
  • Applies to all elements
  • Inherited no
  • Media visual
  • Computed Value as specified, but with URIs made absolute
  • Animatable no
  • Canonical order the unique non-ambiguous order defined by the formal grammar


Formal syntax: <bg-image>#
background-image: none
background-image: url(
background-image: inherit


Is a keyword denoting the absence of images.
Is an <image> denoting the image to display. There can be several of them, separated by commas, as multiple backgrounds are supported.


body {
  background-image: url("images/darkpattern.png");
div {
  background-image: url("images/foo.png"), url("images/bar.png");
p {
  background-image: none;


Desktop browsers

FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support1.01.0 (1.7 or earlier)
Multiple backgrounds1.03.6 (1.9.2)9.0yes1.3
Gradients1.0-webkit3.6 (1.9.2)-moz1011+-o4.0-webkit
SVG images8.04.0 (2.0)
element()NA (Yes)-mozNot supportedNot supportedNot supported
image-rect()Not supported (Yes)-mozNot supportedNot supportedNot supported
Any <image> value.NANot supportedNANANA

Mobile browsers

FeatureiOS SafariOpera MiniOpera MobileAndroid Browser
Basic supportyesyesyesyes
Multiple backgroundsyesyesyesyes
Gradientsyes -webkit
old webkit syntax for iOS 4.2 and older
old webkit syntax
SVG imagesyesyesyesNot supported
element() (Yes)-mozNANANA
image-rect() (Yes)-mozNot supportedNot supportedNot supported
Any <image> valueNot supportedNANANA

Relative articles