Reputation: 101
On iPad and iPhone my sites background doesn't display. On everything else browser works fine (Safari, Chrome, IE and Mozilla)
My css code is:
background:url(../photos/shutterstock2.jpg);
background-size:2800px 1500px;
background-repeat:no-repeat;
background-color: #94C5EB;
Upvotes: 1
Views: 1077
Reputation: 394
Try this:
html {
background: url(../photos/shutterstock2.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-color: #94C5EB;
}
We can do this purely through CSS thanks to the background-size property now in CSS3. We'll use the html element (better than body as it's always at least the height of the browser window). We set a fixed and centered background on it, then adjust it's size using background-size set to the cover keyword.
This should give you an awesome and progressive CSS3 way!
Upvotes: 5