Reputation: 537
I have a set of images being displayed which cannot be bigger than 100px x 59px. I do however have a number of these images which scale smaller to around about 70px x 59px. For this I have this line of HTML to display the images:
<img src="image/image1.jpg " max-width="100px" max-height="59px" alt="Image1">
This does not however limit the constraints and are displaying the orginal size of the image regardless.
Why is this happening?
Upvotes: 0
Views: 180
Reputation: 23
use "style"
<img src="image/image1.jpg" style="max-width: 100px; max-height: 59px;" alt="Image1">
Upvotes: 1
Reputation: 85545
You need to set width: 100%;
and height: 100%;
as well.
Upvotes: 0
Reputation: 1652
rather than using max-height and max-width, use only height and width attribute. But it will eventually stretch your images in case they are of lesser size.
Upvotes: 0