Set a background-image for the <body> element:
More "Try it Yourself" examples below.
The background-image property sets one or more background images for an element.
The background of an element is the total size of the element, including padding and border (but not the margin).
By default, a background-image is placed at the top-left corner of an element, and repeated both vertically and horizontally.
Tip: Always set a background-color to be used if the image is unavailable.
Default value: | none |
---|---|
Inherited: | no |
Animatable: | no. Read about animatable |
Version: | CSS1 |
JavaScript syntax: | object.style.backgroundImage="url(smiley.gif)" Try it |
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
background-image | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Note: IE8 and earlier do not support multiple background images on one element.
Value | Description |
---|---|
url('URL') | The URL to the image. To specify more than one image, separate the URLs with a comma |
none | No background image will be displayed. 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 |
Set multiple background images for the <body> element:
CSS tutorial: CSS Background
CSS3 tutorial: CSS3 Backgrounds
HTML DOM reference: backgroundImage property