Static Background while scrolling / easy solution?


#1

Hello People,

Is it possible to get a backgroundimage to stay while scrolling where it is with css only ?
I am using this code to set the background:
.main {
height: 600px;
background: url(https://s3.amazonaws.com/codecademy-content/projects/move/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

The HTML part right now:

> <div class="main">
>       <div class="container">
>         <h1>MOVE</h1>
>         <p>Form healthy habits to take your fitness to the next level.</p>
>         <a href="#">START NOW</a>
>       </div>
>     </div>

thank you

best regards,
NNDR


#2

background attachment seems to be what you need, if it doesn't, check background for all possible properties and values


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.