PDA

View Full Version : Google backgrounds, how do they do it?



mattcoady
07-29-2010, 03:51 AM
When you go to google now you can choose to give the homepage a background. The way they've done it dynamically resizes the image to always fit the longest edge of the browser in ratio, while still maintaining the aspect ratio.

I've been trying to do just this but all the css methods I can come up with always:

a) leave white space above or below the image or
b) stretch the image out of proportion.

...so I assume it must be java related. I've noticed they don't use % to indicate the width and height but rather some code is dynamically changing the pixel count. I've also noticed it's not a css background image but rather a placed image in a fixed position.

Has anyone found a way to do this or know if it can be easily done?