Home › Forums › CSS › [Solved] Fixed Background within Container? › Reply To: [Solved] Fixed Background within Container?
March 2, 2014 at 12:23 pm
#164512
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
.