I have a div
area like this:
<div class="con">
<div class="container"></div>
<div class="sidebar"></div>
</div>
And CSS:
.con{
width:100%;
}
.con .container{
width:70%;
min-height:500px;
float:left;
background:#f00;
}
.con .sidebar{
width:30%;
min-height:500px;
float:right;
background:#ccc;
}
The container
and sidebar
class heights are dynamic. When one of these class heights increases, class con
also has to increase. But my problem is class con
height is always 0, I can't seem to give the con
class a static height.
It is mostly used with textarea and div elements. To disable resizable property of an element use resize to none.
The reason why the height or the containers is 0 is because you are floating all the content inside them and floated elements don't expand the height (or width) of their parents.
Add overflow: auto;
to .con
:
.con {
width: 100%;
overflow: auto;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With