Posted By: Anonymous
I want that my background image stretch and scale depending on the browser viewport size.
I’ve seen some questions on Stack Overflow that do the job, like Stretch and scale CSS background for example. It works well, but I want to place the image using
background, not with an
In that one an
img tag is placed, and then with CSS we tribute to the
It works, but that question is a bit old, and states that in CSS 3 resizing a background image will work pretty well. I’ve tried this example the first one, but it didn’t work out for me.
Is there a good method to do it with the
CSS3 has a nice little attribute called
This scales the image so that the background area is completely covered by the background image while maintaining the aspect ratio. The entire area will be covered. However, part of the image may not be visible if the width/height of the resized image is too great.