Background Attachment in CSS
The background-attachment Property
The background-attachment property sets whether a background image will be fixed or scroll with the page. If set to fixed, then the image will not move even if the user scroll. When set to scroll, the background image will scroll with the rest of the content.
Syntax:-
Its syntax is:-
< style >
element{
background-attachment: scroll| fixed| local| initial| inherit;
}
< /style >
Further Explanation:-
Value | Description |
---|---|
scroll | The background image will scroll with the page. |
fixed | The background image will not scroll with the page |
local | The background image will scroll with the element's contents |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |