Background image fluid: possible?

Hello,

I was wondering if it was possible to make a background image fluid. Or do I have to use the img element and max-width?

Regards,

-jj. :slight_smile:

.whatever {
background: put your usual stuff here;
background-size: 100% 100%;
-webkit-background-size: 100% 100%;
-moz-background-size: 100% 100%;
-o-background-size: 100% 100%;

It won’t work with IE8 and older versions.

Russ has a good article on the new background properties that CyberAlien mentioned above.

For old browsers you still have to use a foreground image if you want it to stretch (or a little js to keep it within limits)