![]() |
VOOZH | about |
The background-attachment property sets whether a background image scrolls with the rest of the page or is fixed. It has three possible values: scroll (default, the image moves with content), fixed (image stays in place), and `local` (image scrolls within the element).
background-attachment: scroll|fixed|local|initial|inherit;| Property | Description |
|---|---|
| scroll | Sets the background image to stay fixed relative to the containing element and scroll with the page. Default value. |
| fixed | Sets the background image to stay fixed relative to the viewport. |
| local | Sets the background image to scroll along with the content of its container element. |
| initial | Sets the background-attachment property to its default value. |
| inherit | Inherits the property from its parent element. |
In this example, we are using background-attachment: scroll property.
Output:👁 Image
In this example, we are using the background-attachment : fixed property.
Output:👁 Image
In this example, we are using background-attachment: local property.
Output:
In this example, we are using background-attachment: initial property.
Output:👁 Image
The browser supported by background-attachment property are listed below: