Test of Fixed Background CSS

Where did the lemons learn
the same creed as the sun?

- Pablo Neruda -

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


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

  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">
  background: yellow url("images/vermeer.jpg");
  background-repeat: repeat-y;
  background-position: center;

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

David J. Hark
P. O. Box 201 Shepherdstown, WV 25443-0201
Last updated: 6 April 1999

© 1999 David J. Hark