Fixed background adjusted to the monitor size

69 views Asked by At

Can you please tell me how to make the background image adjust to the size of the monitor? Here's what I got:

body {
background: url(../images/bg.jpg) #eee fixed no-repeat center;
-webkit-background-size: cover;
   -moz-background-size: cover;
     -o-background-size: cover;
        background-size: cover;
font: 12px Tahoma, sans-serif;

}

Even though I get the vertical scroll bar on one monitor and no scroll bar on the other.

Thanks!

1

There are 1 answers

1
sanchahous On

fixed and centered background

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;

Works in:

Safari 3+
Chrome Whatever+
IE 9+
Opera 10+ (Opera 9.5 supported background-size but not the keywords)
Firefox 3.6+ (Firefox 4 supports non-vendor prefixed version)