CSS property: background-attachment
Description
If background images are specified, this property specifies whether they are fixed with regard to the viewport or scroll along with the element or its contents.
If background images are specified, this property specifies whether they are fixed with regard to the viewport (fixed
) or scroll along with the element (scroll
) or its contents (local
).
Syntax
CSS 2
background: <attachment>;
CSS 3
background: <attachment> [ , <attachment> ]*;
Values
- <attachment>
fixed The background is fixed with regard to the viewport. In paged media where there is no viewport, a ‘fixed’ background is fixed with respect to the page box and therefore replicated on every page. Note that there is only one viewport per view. Even if an element has a scrolling mechanism (see the overflow property), a fixed
background doesn't move with the element.local The background is fixed with regard to the element's contents: if the element has a scrolling mechanism, the background scrolls with the element's contents. In this case, the background behind the element's border (if any) scrolls as well, even though the border itself does not scroll with the contents. The UA may, however, treat the border-box
value of background-clip aspadding-box
in cases where background-attachment islocal
and the contents of the element scroll.scroll (by default) The background is fixed with regard to the element itself and does not scroll with its contents. (It is effectively attached to the element's border.)