CSS background-image
Property
Topic: CSS3 Properties ReferencePrev|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:
The example below shows the background-image
property in action.
Example
Try this code »body {
background-image: url("images/pattern.jpg");
}
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.
Basic Support—
|
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
.