Set a background image for a document:
The backgroundImage property sets or returns the background image of an element.
Tip: In addition to the background-image you should also specify a background-color. The background-color will be used if the image is unavailable.
The backgroundImage property is supported in all major browsers.
Return the backgroundImage property:
Set the backgroundImage property:
Value | Description |
---|---|
url('URL') | The location of the image file |
none | No background image. This is default |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | none |
---|---|
Return Value: | A String, representing the background image |
CSS Version | CSS1 |
Set a background image of a specific <div> element:
Return the background image of a specific <div> element:
Return the background image of a document:
CSS tutorial: CSS Background
CSS3 tutorial: CSS3 Backgrounds
CSS reference: background-image property
HTML DOM reference: background property