Style backgroundImage property
The Style object
Definition and Usage
The backgroundImage property sets or returns the background image of an element.
Syntax
Set the backgroundImage property:
Object.style.backgroundImage="url('
URL
')|none|inherit"
Return the backgroundImage property:
Object.style.backgroundImage
| Value | Description |
|---|---|
| url('URL') | The location of the image file. |
| none | Default. No background image. |
| inherit | The background-image property is inherited from the parent element. |
Browser support





All major browsers support the backgroundImage property.
**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".
Tips and Notes
**Tip:** In addition to a background image, you should also specify a background color. If the image is unavailable, the background color will be used.
Example
Example
Set the background image:
Hello World!
Try it »
The Style object