You can specify sizes in absolute units (cm, in, mm... even px are supposed to be absolute units, not physical pixels).
But I think what you are after is simply "div.cimg img {max-width:100%}". That should show the image at its "natural" size, but resize it down to 100% if it's larger.
Quote:
Originally Posted by rubeus
To solve that the max-width style can be apllied to the img element:
Code:
<div class="cimg">
<img alt="" src="../Images/img07.png" style="max-width: 520px"/>
</div>
Now the image will be resized according to the screen size but this will stop at 520px, the width of the image itself.
|
Wrong. "px" are absolute units 1/96 inches, if I remember correctly, so it won't prevent the image to be magnified if the device resolution is higher than 96ppi.