I'm trying to create a two column 100% height layout using the display table-cell property. It is working fine on Chrome, but I'm not having success on Firefox nor IE.
Here is the fiddle: http://jsfiddle.net/ehfa0kk8/5/
Take a look at how it works on Chrome. Any idea of how to make this work?
<div id="table">
<div id="row">
<div id="cell_1">
<div id="overflown_div">
long content goes here...
</div>
</div>
<div id="cell_2">
Blah blah blah
</div>
</div>
</div>
And the CSS
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#table {
width: 100%;
display: table;
height: 100%;
}
#row {
display: table-row;
}
#cell_1, #cell_2 {
display: table-cell;
height: 100%;
}
#cell_1 {
width: 390px;
background: aliceblue;
}
#cell_2 {
background: yellow;
}
#overflown_div {
height: 100%;
overflow: scroll;
padding: 10px;
}
UPDATE: First, there should be enough content on the left column so it will overflow. On Chrome it shows a scroll bar so you can scroll just the content of that column (cell). On Firefox it doesn't happen.
EXAMPLE:
The trick is:
height
to 100%
height
to 0
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
#table {
width: 100%;
display: table;
height: 100%;
}
#row {
display: table-row;
height: 100%;
}
#cell_1,
#cell_2 {
display: table-cell;
height: 0;
}
#cell_1 {
width: 390px;
background: aliceblue;
}
#cell_2 {
background: yellow;
}
#overflown_div {
height: 100%;
overflow-y: scroll;
padding: 10px;
box-sizing: border-box;
}
#overflown_div p {
height: 80px;
}
<div id="table">
<div id="row">
<div id="cell_1">
<div id="overflown_div">
<p>Blah blah blah</p>
<p>Blah blah blah</p>
<p>Blah blah blah</p>
<p>Blah blah blah</p>
<p>Blah blah blah</p>
<p>Blah blah blah</p>
<p>Blah blah blah</p>
<p>Blah blah blah</p>
<p>Blah blah blah</p>
<p>Blah blah blah</p>
</div>
</div>
<div id="cell_2">
Blah blah blah
</div>
</div>
</div>
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