Search within TutorialsPark

CSS background-attachment Property

To set the attachment of the background to the element.

Definition and Notes.

1. The CSS background-attachment property specifies how the background-image reacts when the page is scrolled.

2. The background-image can either scroll along with the rest of the content or remain static.


CSS background-attachment property. internetexplorer safari firefox opera chrome

View in Splitscreen»


Note-For a paged media, where there isn't a viewport, a 'fixed' background is with respect to the page box and hence replicated on all pages.


Value Description
scroll To make the background to scroll along with the element.
fixed To make the background fixed at a position relative to the browser's viewport
local The background is fixed in relation to element's content.If the element has a scroll bar the background scrolls along with the content.


Specs Value
Name background-attachment
Value see Syntax
Initial Value Same as Individual Properties.
Applies to all elements.
Javascript syntax"scroll | fixed | local"
Inherited No
Browser Support internetexplorer safari firefox opera chrome

Related Examples.