I have a block in a table where user profile pictures are displayed. To maintain design space, I have set the block size to 200px in width and 300px in height. I applied the following CSS style on the pictures:
.max{
max-width:200px;
max-height:300px;
}
When a large picture (e.g. 300x400 px) is displayed, it resizes correctly to 200x300 px. However, if a small picture (e.g. 100x150px) is shown, it also gets resized to 200x300px. I want to preserve the original size of smaller pictures below 200x300px but resize larger images to fit within those dimensions. Can anyone provide guidance on how to achieve this? --(tested on internet explorer 8.0)
If this cannot be accomplished using CSS, is there an option to do it with JavaScript? Are there any reputable sources that can help me with this?