Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] Fixed Background within Container? Reply To: [Solved] Fixed Background within Container?

#164512
Atelierbram
Participant

I want the form to scroll but the container to remain fixed.

When you replace background-position:fixed; with position:fixed; and permit scrolling the container by adding overflow: auto;, then this will be ‘fixed‘ .

.fixedcontainer { 
 background: url(wallpaper.jpg) top right no-repeat;  
 /* background-position:fixed; */ 
 width:100%; 
 height:100%; 
 margin-top:40px;
 background-attachment: fixed;
 position: fixed;
 top: 0;
 left: 0;
 overflow: auto;
}

background-attachment: fixed, prevents the background-image from scrolling with the content. When you don’t want this; remove it, for the default behaviour of background-images is to scroll.

Nice resource on CSS positioning