Suppose I have an image sized originally 1280x720(ratio ~ 1.78), but for some reason I added the image as 1000x720(ratio ~ 1.39). The code should look like below
<img src="example.JPG" style="height:720px; width:1000px;">
(Edit : And the code above can't be changed. Actually in the first question I said 'I added', but actually the html source is from WYSIWYG editor. Also, the author(user, as it is WYSIWYG editor) wants to add up the image size 1000x720 or proportional to it(ratio ~ 1.39) even though it can make ugly image)
And, to resize the image proportionally when the screen width is smaller than 1000px, I set the max-width as 100%, and height as auto using css:
img {
height: auto;
max-width: 100%;
}
Then, the 'auto' option for height is ignored, and image isn't resized proportionally. If I override 'auto' option for height using keyword 'important', then the image is resized, but as ratio 1.78(proportional to 1280x720), not 1.39(proportional to 1000x720, and it's what I want to do).
Is there any solution for this using pure css? (AND without calculating ratio by hand, as the given example is only for 1000x720 but I can't expect what size would I get from the user in real service. Maybe they can insert image size as 500x720 even though its real size is 1280x720.)