Background-attachment

Set the position of a background image relative to the rest of the page.

Syntax
      background-attachment: scroll | fixed | local | inherit ;

scroll - The background image scrolls with the rest of the page (default).
Fixed - Position the image relative to the entire window.
local - The background image scrolls with the element.
inherit - inherit from the parent element

When background-attachment is set to fixed, then the image (if it's small and set to not repeat) may scroll outside the containing DIV and become invisible. Test your layout by resizing the web browser.

New in CSS3 is the ability to specify multiple background images. You can (optionally) specify the background-attachment for multiple images as a comma-separated list, these will then be applied (in order) to each of the images specified by background-image.

Examples:
h1 { background-attachment: fixed; }
.ss64class { background-attachment: inherit; }
#ss64id { background-attachment: scroll; }

Try it:

This is a sample of text that can be given a CSS background. This is a sample of text that can be given a CSS background. This is a sample of text that can be given a CSS background. This is a sample of text that can be given a CSS background.

(CSS 1) Browser Support: All major browsers.

“Something is wrong here, and it's more than easy access to guns or violence on TV. It's about lack of love and attachment to loving people early in life ~ Rob Reiner

Related:

Background-Color - The background color of an element.
Background-Image - The background image for an element.
Background-Position - Starting position of a background image.
Background-Repeat - How a background image will be repeated.
background - A shorthand property for the properties above


© Copyright SS64.com 1999-2014
Some rights reserved