I trying to wrap image inside a div, but the div gets expanded by the parent div.
<div id="parent" style="display: inline-block; position: relative; text-align:center">
<div id="wrapper">
<img>
</div>
<p>Some text that expands the wrapper div more than image width</p>
</div>
The text field expands the parent div to be wider than the image and this also expands the wrapper div. How can I make the wrapper div to be exactly the same size as the img?
img nor the wrapper have no margin or padding, but yet wrapper div is wider than the image.
Use display:inline-block
on #wrappper
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments