Keenan Payne
Keenan Payne

Reputation: 816

Background won't cover entire div

So I am having just a small issue with a site that I am modifying for a client: http://gator3094.hostgator.com/~sunhome/staging/.

As you can see, the background image that I am putting around the <header></header> tags is not stretching the full height of the div.

Here is a link to my CSS file (everything else is just stock Foundation Framework): http://gator3094.hostgator.com/~sunhome/staging/wp-content/themes/sunpower_theme_sunsolar/library/css/custom.css

Here is also the CSS code that I am using for that particular section of the site:

header { 
    background: url('http://gator3094.hostgator.com/~sunhome/staging/wp-content/uploads/home-bg2.png') no-repeat center center fixed; 

    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

I have done these full-width cover backgrounds with CSS3 a million times, but I have absolutely no idea why this time the image won't cover the entirety of that div.

Hopefully it's just a super simple fix. I would really appreciate any and all help.

Upvotes: 0

Views: 627

Answers (1)

agconti
agconti

Reputation: 18093

Your issue is because of the lack of appropriate cropping of your background image.

Try this with your header tag:

header { background: black;}

You'll see that the background takes up the appropriate dimensions of the div. The reason white space is showing is because your background image has a lot of extra transparent space around the image. So the background is repeating appropriately, you just need to crop it so it will show the part of image you want.

Still dont belive me?

Try replacing it with this:

header { background: url("http://placekitten.com/1800/950");}

Upvotes: 1

Related Questions