View Full Version : Scaling Background Images?

07-03-2011, 10:30 PM
Is it possible to scale DIV background images as the user zooms the site if the site uses EM units of measurement? I need to do this to stop my design layout falling apart when users resize their text. My designs are very carefully planned and executed, therefore I do not want my pages to look bad in the event of viewers messing with their browser's settings.


07-04-2011, 05:28 AM
I know you can use javascript to obtain the window size and work accordingly, but CSS3 does have a solution.

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;

And that works great! But to does depend on original size and the ratios. It tries to keep the ratios the same.