CSS background-image Property

Description

The background-image property sets the background image for an item. If the background color is set for an element at the same time, it will be shown until the background image is fully loaded. The same will happen if the images are not available or their display in the browser is disabled. If there are transparent areas in the picture, the background color will look through them. It is permissible to specify several background images, listing their parameters separated by commas.

Initial value
none
Applies to
All elements
Inherited
No
Computed value
As specified, but with URIs made absolute
Animatable
No
JavaScript syntax
object.style.backgroundImage

Syntax

background-image: <bg-image> [ , <bg-image> ]* 

Values

<bg-image> = <image> | none
  • <image>Is an <image> denoting the image to display. There can be several of them, separated by commas, as multiple backgrounds are supported.
  • noneColor of the next parent through which the background is visible.
  • inherit

Example

<p>Example of the background-image css property</p>
body { 
   background-image: url(images/icon1.png); 
   background-color: #c7b39b; 
}
p {
   padding: 10px;
   background: white;
   color: black;
}

Give it a Try

Click the button below to experiment with this property.

Give it a Try!

Browser Support

The following table will show you the current browser support for the CSS background-image property.

Desktop
Edge Chrome Firefox Opera Safari
12113.51
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
184141137

Last updated by CSSPortal on: 20th September 2023