I have a responsive website, where I am resizing all my images in the corresponding CSS3 media query’s viewports. I’m wondering if there’s an easier way to state that I want all my images to resize maintaining their original stated dimensions as opposed to manually resizing each accordingly with max-height, width, etc. Any suggestions?
EG Below.
/* Smartphones (portrait) ----------- */
@media only screen and (max-width : 320px) {
#logoimg { max-height: 100px; max-width: 100px; }
}
I believe declaring img {max-width:100%} should do the trick. The image will scale down and maintain its dimensions.