How to make a div expand vertically to wrap the content within it?
Posted
by MalcomTucker
on Stack Overflow
See other posts from Stack Overflow
or by MalcomTucker
Published on 2010-04-10T19:21:42Z
Indexed on
2010/04/10
19:33 UTC
Read the original article
Hit count: 240
css
I have a div which wraps a number of images that are generated dynamically. I don't know how high the list of images is. My problem is the div that contains the dynamically generated images doesn't behave like it is housing any content - I want it to extend to the height of the list of images. Each image is itself wrapped in a div.
This is the wrapper div:
.block { padding:10px; margin-top:10px; height:auto; background-color:#f9f9f9; }
This is the markup dynamically generated for (one of) the images:
<div class="block">
<div style="float: left; padding: 2px 2px 2px 2px;"><IMG SRC="45.jpg" BORDER="0"/></div>
.....
How do I get the block
div to extend down with the images?
Thanks
© Stack Overflow or respective owner