Expand height of parent div with the content of inner child div
I dont have much detail for this but hope I could draw on others knowledge on this matter.
I have a div which has a minimum height set on it. This div contains content and is repeated multiple times in a .net repeater.
This works fine.
Within the main div is another div. This contains more content of which can span multiple lines. The issue I have is that if the child div is higher than the parent div, the parent div does not expand in height. And as its within a repeater, the content of the child div expands onto the next parent div. Is there a way via css I can expand the parent div so that expands with the content of the child div.
This is a very much scaled down version of my markup:
<div class="row">This is content ... blah blah<div class="child">ahdshfjhdsfjk <br/><br /><br /><br /><br />jkljlkj<br />jjkljl<br /></div></div>
Any help would be开发者_StackOverflow great as to how to fix this
From what I remember you can try adding a "clear" at the end of your containing div like so:
<div class="row">
This is content ... blah blah
<div class="child">
ahdshfjhdsfjk
<br/><br /><br /><br /><br />
jkljlkj
<br />
jjkljl
<br />
</div>
<br style="clear: both;" />
</div>
This is why it's better to know standard html and css and not proprietary .NET stuff that hides things from you. What you show should do what you want. The issue lies in the CSS and without that, everything's a wild guess but probably related to the inside div being floated or otherwise positioned.
精彩评论