Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
148
rated 0 times [  152] [ 4]  / answers: 1 / hits: 16485  / 13 Years ago, wed, july 27, 2011, 12:00:00

I need to set maximum height and width of a image in <img> tag. For example say max size is 400x400 px so if the image size is smaller than this then it will show the image as it is and if size is bigger then this then it should be compressed to this size. How can I do this in html or javascript?


More From » html

 Answers
37

Set the max-width and max-height in CSS



max-width: 400px;
max-height: 400px;

[#90974] Tuesday, July 26, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
monetm

Total Points: 615
Total Questions: 103
Total Answers: 119

Location: Finland
Member since Fri, Oct 21, 2022
2 Years ago
;