how to keep the height of the div equal to the union of the height of elements inside it

Posted by Idlecool on Stack Overflow See other posts from Stack Overflow or by Idlecool
Published on 2010-05-30T12:16:04Z Indexed on 2010/05/30 12:22 UTC
Read the original article Hit count: 204

Filed under:

I have been making a wordpress template. i got stuck at some place...

the problem is,

how to maintain the size of a div >= the size of p tags and img tags...

i have seen that the div only able to contain the p tag but the img tag over flows...

i have my code in this following order:

<div>
<p> some contents <img src="an_image"/> some morecontent</p>
<div>

what i basically want is:

div height = <p> height U(union) <img> height

but, what actually i am getting is:

div height = <p> height; while <img> over flows

i have already checked for similar questions on Stack Overflow but was not able to find one which solves a similar problem.. please give me some idea..

© Stack Overflow or respective owner

Related posts about css-layout