CSS:background
From MDC
[edit] Summary
The background property is a shorthand property for setting the individual background property values in a single place in the style sheet. background can be used to set the values for one or more of: background-attachment, background-color, background-image, background-position, background-repeat.
- Initial value: see individual properties for details
- Applies to: all elements
- Inherited: no
- Percentages: allowed on
background-position - Media:
visual - Computed value: see individual properties
[edit] Syntax
background: [ <background-color> || <background-image> ||
<background-repeat> || <background-attachment> ||
<background-position>
] | inherit ;
[edit] Values
- background-color
- See
background-color. - background-image
- See
background-image. - background-repeat
- See
background-repeat. - background-attachment
- See
background-attachment. - background-position
- See
background-position.
[edit] Examples
body {
background: red;
}
.topbanner {
background: url("topbanner.png") #00D repeat fixed;
}
[edit] Notes
Given a valid declaration, the background property first sets the individual background properties to their initial values, then assigns the explicit values specified in the declaration. You do not have to define a value for each of the individual properties, only those you want to change from their initial defaults.
[edit] Specifications
[edit] Browser Compatibility
| Browser | Lowest Version |
|---|---|
| Internet Explorer | 4 |
| Firefox | 1 |
| Netscape | 6 |
| Opera | 3.5 |
[edit] See Also
background,
background-attachment,
background-color,
background-image,
background-position,
background-repeat