css:image:resize_an_image_dynamically
css - Image - Resize an image dynamically
img { max-width: 100%; height: auto; width: auto\9; /* ie8 */ }
NOTE: max-width:100% and height:auto works in IE7, but not in IE8 (yes, another weird IE bug). To fix this, you need to add width:auto\9 for IE8.
and if you want to enforce a fixed max width of the image, just place it inside a container, for example:
<div style="max-width:500px;"> <img src="..." /> </div>
css/image/resize_an_image_dynamically.txt · Last modified: 2021/08/08 12:36 by peter