I have two divs those are supposed to have the same height. So I am using display: table
on the container and using display: table-cell
in the child divs. However these childs are using a common .css file which contains float:left
in it. On the firebug, when I remove this float:left
everything seems working as it is intended. I spend hours but I couldn't find the answer by my self.
The real example is more complex but here is an example.
.container {
float: left;
min-width: 100%;
margin: 0;
padding: 0;
border-collapse: collapse;
font-family: Arial, Helvetica, sans-serif;
font-size: 75%;
}
.panels {
width: 100%;
height: 90px;
display: table;
}
.panel-left {
width: 75%;
padding-right: 0.5%;
padding-bottom: 10px;
height: 100%;
display: table-cell;
background-color: #124458
}
.panel-right {
width: 25%;
padding-bottom: 10px;
height: 100%;
display: table-cell;
background-color: #456845
}
.height {
height: 100%;
}
.box {
height: calc(100% - 10px);
box-sizing: border-box;
margin-bottom: 10px;
min-width: 100%;
float: left;
}
.box-title {
border-radius: 10px 10px 0 0;
background-color: white;
font-weight: bold;
height: 20px;
line-height: 20px;
padding: 5px 15px;
color: #003278;
}
.box-inside {
height: calc(100% - 20px);
box-sizing: border-box;
background: #f3f6f9;
border-radius: 0 0 10px 10px;
padding: 10px 15px;
float: left;
min-width: 100%;
color: black;
}
form {
margin-top: 8px;
background: #f3f789;
height: 20px;
}
table {
width: 100%;
border-spacing: 0 0;
white-space: nowrap;
border-collapse: collapse;
color: black;
}
<div class="container">
<div class="panels">
<div class="panel-left">
<div class="height-100">
<div class="box">
<div class="box-title">
LEFT PANEL
</div>
<div class="box-inside">
<form>
<table>
<button>
</button>
</table>
</form>
</div>
</div>
</div>
</div>
<div class="panel-right">
<div class="height-100">
<div class="box">
<div class="box-title">
RIGHT PANEL
</div>
<div class="box-inside">
<span>STATUS</span>
</div>
</div>
</div>
</div>
</div>
</div>
This is a bit different but very close to my case.
On my screen I see this:
Also, when I checked the example with display:table
and display:table-cell
, I see that no one else is using float left or right
. However I have to have it since it comes from the common css and other components are using it.