English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
CSS background-The image attribute sets the background image of the element. It usually uses a shorthand notationBackgroundAttribute is more convenient.
The following table summarizes the usage context and version history of this attribute.
Default value: | none |
---|---|
Applicable to: | All elements |
Inheritance: | None |
Animated: | No.Please see Animation properties. |
Version: | CSS 1,2,3 |
JavaScript syntax: | object object.style.backgroundImage="url(image.gif)" |
The syntax of this attribute is as follows:
background-image: url | none | initial | inherit
The following example demonstrates how to use background-image attribute.
body {background-image: url("images/pattern.jpg");}Test to see‹/›
Warning: Internet Explorer 8And earlier versions do not support multiple background images on a single element.
The following table describes the values of this attribute.
Value | Description |
---|---|
url | The location path of the image resource used as the background image. |
none | Default value. If specified, the background image will not be displayed. |
initial | Set this attribute to its default value. |
inherit | If specified, the associated element uses its parent element's background-Computed value of the image attribute. |
background-Browser compatibility of the image attribute, all mainstream browsers support this attribute.
|
Please refer to the following tutorials:CSS background,CSS3Background.
Related attributes:background,background-attachment,background-color,background-clip,background-origin,background-position,background-repeat,background-size.