CSS background-image property
The background-image property can be used to set an image as the background of an element.
This property is NOT inherited
Possible values
| Value | Description |
|---|---|
| url | The location of the image |
| none | No background image (default) |
Example
Output:
Javascript
You can access this property with Javascript:
element.style.backgroundColor="url(images/bricks.jpg)";
Other background properties
background
background-attachment
background-color
background-position
background-repeat
CSS background examples
Setting a background color
Setting a background color for a table
Setting a background image for a page
Setting a background image for a table
Setting a background image that does not move
Setting a background image that repeats horizontally
Setting a background image that repeats vertically
Setting a background image that repeats for the whole page
Setting a background image that is center positioned
Setting a background image that is center positioned and does not move
Setting all the background properties with one declaration
More CSS examples