Reputation: 2059
I have a problem with my parent div height.
It's not containing children in it.
JSBIN: JSBin
Basic of problem is:
I have code like this:
<div class="itemsContainer">
<div class="left">
--SOME STUFF--
</div>
<div class="right">
--SOME STUFF--
</div>
</div>
And .itemsContainer
calculated height does not contains height of children.
Look at JSBin for more code.
Could you please give me a hint, how can i fix that?
Upvotes: 0
Views: 247
Reputation: 15699
It is happening because floats
are not being cleared.
Solution1:
Clear floats.
HTML:
<div class="itemsContainer">
<div class="left">
--SOME STUFF--
</div>
<div class="right">
--SOME STUFF--
</div>
<div class="clear"></div>
</div>
CSS:
.clear{clear:both;}
Solution2:
Add following:
.itemsContainer{overflow:hidden;}
Upvotes: 2
Reputation: 13988
Clear your float element after the child div complete like below.
<div class="itemsContainer">
<div class="left">
--SOME STUFF--
</div>
<div class="right">
--SOME STUFF--
</div>
<div style="clear:both"></div>
</div>
Upvotes: 0