I have a #main
div which contains two divs(#left and #right).I have another div #below_main
which is after #main
.
Problem: When the height is not set for the #main
then those content mess the #below_main
. I don't want to have static height for the #main
because this is more like content posting height will change dynamically according to content amount.
So i tried min-height
for #main
but doesn't work i also tried position
to relative
for #main
that too doesn't work.
Now how to set this as no matter the #main #left
content is, but the #main_below
should start after the content(#main) div.
I believe the float in left what making differences. If that so please explain me. Any help?
CODE
HTML
<div id="main">
<div id="left">
<!-- Dynamic contents -->
</div>
<div id="right">
</div>
</div>
<div id="below_main">
<ul class="st">
<li>list1</li>
<li>list2</li>
<li>list3</li>
<li>list4</li>
</ul>
<ul class="st">
<li>list1</li>
<li>list2</li>
<li>list3</li>
<li>list4</li>
</ul>
<ul class="st">
<li>list1</li>
<li>list2</li>
<li>list3</li>
<li>list4</li>
</ul>
<ul class="st">
<li>list1</li>
<li>list2</li>
<li>list3</li>
<li>list4</li>
</ul>
</div>
CSS
#main {
background: #ffffff;
width:980px;
margin-top:20px;
}
#main #left {
width:610px;
float: left;
padding:0 0 0 40px;
}
#main #right {
width:280px;
float:right;
padding:0 25px 0 0;
}
#below_main {
height:225px;
width:980px;
border:1px solid #dddddd;
margin-top:20px;
border-radius: 10px;
background:rgb(0,100,0);
}
#below_main ul.st {
list-style: none;
margin: 50px 0 0 0;
padding: 0 0 0 55px;
float:left;
width:140px;
font-size: 11px;
}
EDITS AFTER POSTING THIS QUESTION
Thanks all, clear:both
helps but the background color is not filling upto the content.Do you have any idea? i believe this is due to no height specified.how to do it without height?
Check This fiddle