I'm working on a fully fluid web page with a parent DIV set to width: 100%. Inside this div, there's an image with the following style:
<div>
<img src="image.png" alt="" />
</div>
<style>
div { width: 100%; }
img {
display: block;
margin: auto;
max-width: 100%;
}
</style>
The image is centered within the div, but there is white space between the borders of the image and the div since the image is smaller than the parent DIV. When I resize the browser window, the image does not resize until the parent DIV reaches the image borders.
If I were to set the image's width to 100%, it would stretch beyond its actual size...
I want the image to scale immediately with the div when the browser window is resized. If the image canvas were set to 100% of the parent div, I could achieve this desired behavior. However, I am unable to set images up in that way...