I\'d like to fill a div with an img
, keeping aspect ratio and stretching either width or height as much as required to fit in.
.thumb {
max-width:100%;
height:auto;
}
Or ( to allow scale up and down, which will look pixelated if you scale up, where the above will only scale to the max size of the image )
.thumb {
width:100%;
height:auto;
}
Is what you are looking for.
More info on responsive images:
http://demosthenes.info/blog/586/CSS-Fluid-Image-Techniques-for-Responsive-Site-Design
http://www.w3schools.com/css/css_rwd_images.asp