I have an image which I need to a max width as its parent element.
With this code the image is shown with a width of 600px. I need the image to have a width equal to 400px, even though the natural width of the image is 600px.
How can I do this?
<div style="width: 400px">
<table>
<tr><td>
<img widht="600" ..../>
</td></tr>
</table>
</div>
I have this css:
table, img
{max-width:100%}
img{ width: 100%; }
will sort you out. This will 'expand' the image width the the size of the containing element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With