Name
background-image — NN 4 IE 4 CSS 1
Synopsis
Inherited: No
Sets the background image (if any) for the element. If you set a
background-color
for the element as well, the
color appears if the image fails to load; otherwise, the image
overlays the color. Transparent pixels of the image allow a
background color to show through. See also the
background-attachment
attribute.
CSS Syntax
background-image: uri
| none
JavaScript Equivalent
backgroundImage
Value
To specify a URL, use the url()
wrapper for the
attribute value. You can omit the attribute or specify
none
to prevent an image from loading into the
element’s background.
Initial Value
none
Example
H1 {background-image: url(watermark.jpg)}
Applies To
All elements.
Object Model Reference
- IE
[window.]document.all.
elementID
.style.backgroundImage
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.