Test of Fixed Background CSS
Silence is the
essential condition
of happiness.
- Heinrich Heine -









'background-attachment' 
Value:   scroll | fixed | inherit  
Initial:   scroll  
Applies to:   all elements  
Inherited:   no  
Percentages:   N/A  
Media:   visual  

If a background image is specified, this property specifies whether it is fixed with regard to
the viewport ('fixed') or scrolls along with the document ('scroll'). 

Even if the image is fixed, it is still only visible when it is in the background or padding
area of the element. Thus, unless the image is tiled ('background-repeat: repeat'), it may be
invisible. 

Example(s):

This example creates an infinite vertical band that remains "glued" to the viewport when the
element is scrolled. 

BODY { 
  background: red url("pendant.gif");
  background-repeat: repeat-y;
  background-attachment: fixed;
}

User agents may treat 'fixed' as 'scroll'. However, it is recommended they interpret 'fixed'
correctly, at least for the HTML and BODY elements, since there is no way for an author to
provide an image only for those browsers that support 'fixed'. See the section on conformance
for details. 









Change the code of this page to:


<STYLE TYPE="text/css">
<!--
BODY { 
  background: yellow url("images/vermeer.jpg");
  background-repeat: repeat-y;
  background-position: center;
}
-->
</STYLE>



































Home | Handout | Searching | Show Me | Tell Me | Buildit


David J. Hark
HARK/INTERNET-HELP
P. O. Box 201 Shepherdstown, WV 25443-0201
304-876-2607
dhark@fred.net
dhark@intrepid.net
http://www.fred.net/dhark
http://www.ohurley.com/dhark
Last updated: 6 April 1999


© 1999 David J. Hark