background

Defines the background properties for an element.

Platform Support

IENetscapeMozillaOperaSafari
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.
#ffffffbackground-color: Background color placeholder. e.g. #ffffff = white
url(image-url.gif)background-image: Background image placeholder
nonebackground-image: No background image.
inheritbackground-attachment: Inherit the value from the parent element.
scrollbackground-attachment:Background image scrolls with the document.
fixedbackground-attachment:Background image is fixed as the document scrolls.
topbackground-position: Top of the parent element or window.
centerbackground-position: Center of the parent element or window.
bottombackground-position: Bottom of the parent element or window.
leftbackground-position: Left edge of the parent element or window.
rightbackground-position: Right edge of the parent element or window.
repeatbackground-repeat: Image repeats both horizontally and vertically.
repeat-xbackground-repeat: Image repeats horizontally.
repeat-ybackground-repeat: Image repeats vertically.
no-repeatbackground-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

Related

text_css aptana_docs