0

I have a div, .cover-section, that I want to have a full background image that is the size of the viewport. I want to use the cover css property. I have got this working for the body of the page, but if I add more content and try to scroll, the image stays as the background. I want the image to scroll along with the content. This is what I have so far:

.cover-section {
    background-image: url('../images/cover.jpg');
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
}

How would I get it to do what I want?

jdc987
  • 743
  • 3
  • 10
  • 20
  • If you want the image to scroll with the content, you probably don't want `background-attachment: fixed`. Generally, background image scrolling doesn't work unless the background is applied to the viewport - do you have a specific reason to apply it to a div instead of the body in this case? – BoltClock Jul 14 '14 at 03:41

1 Answers1

0

Remove this line
background-attachment: fixed;

Rahiil
  • 110
  • 1
  • 11