Property Description
The background-attachment property sets whether a background image is fixed or scrolls with the document.
This property has the following syntax:
background-attachment: scroll|fixed|local|initial|inherit;
Property Values
| Value | Description |
|---|---|
| scroll | (default) Specifies that the background image scrolls with the document |
| fixed | Specifies that the background image is fixed |
| local | Specifies that the background scrolls along with the element's contents |
| initial | Specifies that the value of the property should be set to the default value |
| inherit | Specifies that the value of the property should be inherited from the parent element |
Examples
This example shows how to specify a fixed background-image.
body {
background-image:url('bg-image.gif');
background-repeat:no-repeat;
background-attachment:fixed;
}
Browser Support
| Chrome | Firefox | IE | Safari | Opera |
|---|---|---|---|---|
| 1.0 | 1.0 | 4.0 | 1.0 | 3.5 |
Miscellaneous Information
| Inherited: | No |
|---|---|
| Defined In: | CSS1 |
| Default Value: | scroll |
