I have a flexbox container with a max-height
. It has two children, flexed horizontally, one of which has overflow: auto
. In Chrome, the child with overflow stops growing and scrolls once it reaches the container's max-height. In Firefox, it overflows the container.
I'm developing against latest Chrome (currently 59), but must support Firefox 40+, so I'm testing using Firefox 40. For reference, caniuse.com reports that FF40 fully supports flexbox.
This is apparently working properly in newer FF versions, but not in FF40 that I'm using, so for those without access to an older FF, here are screenshots of the behavior I'm seeing:
I can resolve this by eliminating the child on the left and setting flex-direction: column
on the container, but unfortunately my actual application needs that content on the left and needs it flexed horizontally.
Why the discrepancy across browsers? What's the cross-browser solution to allow the child with overflow to stop growing as it does in Chrome?
div { padding: 10px; }
#container {
border: 1px solid green;
display: flex;
max-height: 200px;
}
#left {
border: 1px solid purple;
flex: 1;
}
#right {
border: 1px solid orange;
flex: 3;
overflow: auto;
}
<div id="container">
<div id="left">
Left content
</div>
<div id="right">
I stop growing at 200px tall in Chrome, but not in Firefox
<ul>
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
</ul>
</div>
</div>