background-attachment

background-attachment

CSS background-attachment Property
The CSS background-attachment property is used to set backgrounds to be fixed in place, or to be scrolled with content.
CSS CODE EXAMPLE
<style type="text/css">
#myDiv {
    background-image: url(myBG.jpg);
    background-attachment: local;
    width:300px;
    height:100px;
    overflow:auto;
}
</style>
<div id="myDiv">
  <p>Content ...</p>
  <p>Content ...</p>
  <p>Content ...</p>
  <p>Content ...</p>
  <p>Content ...</p>
  <p>Content ...</p>
</div>
 
Content ...
Content ...
Content ...
Content ...
Content ...
Content ...

Possible Values:

fixed
Fix a background image to the viewport of an HTML element so it does not move.

scroll
Make an HTML element's background image scroll along with the element as it moves.

local
Use to make your background image scroll with the content inside elements. There must be enough content in your container to make scroll bars appear to see this effect.

0 Response to "background-attachment"

Post a Comment