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.
CSS
html {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
I love you.