Defines the background properties for an element.
Platform Support
| IE | Netscape | Mozilla | Opera | Safari | 4.0+ | 4.0+ | 1.0+ | 4.0+ | 1.0+ |
|---|
Usage
[color] [url(image-url) | "none"] [attachment] [position] [repeat]
Values
| * | Specify a value for background that is not on this list. |
| #ffffff | background-color: Background color placeholder. e.g. #ffffff = white |
| url(image-url.gif) | background-image: Background image placeholder |
| none | background-image: No background image. |
| inherit | background-attachment: Inherit the value from the parent element. |
| scroll | background-attachment:Background image scrolls with the document. |
| fixed | background-attachment:Background image is fixed as the document scrolls. |
| top | background-position: Top of the parent element or window. |
| center | background-position: Center of the parent element or window. |
| bottom | background-position: Bottom of the parent element or window. |
| left | background-position: Left edge of the parent element or window. |
| right | background-position: Right edge of the parent element or window. |
| repeat | background-repeat: Image repeats both horizontally and vertically. |
| repeat-x | background-repeat: Image repeats horizontally. |
| repeat-y | background-repeat: Image repeats vertically. |
| no-repeat | background-repeat: Image does not repeat. |
Example
To specify a background image in an "images" directory named myCat.jpg that repeats vertically, use the following syntax: body {background: url(images/myCat.jpg), repeat-y}.
Remarks
Use the background property as a shortcut to typing out all of the individual background properties separately. You can specify any valid value for a background- property as part of background.
Availability
W3C CSS2
