On Chrome I encountered Flexbox behaviour I don't understand. When a flex child which is also a flex container has flex: 1 0 0px
, it collapses itself and it's contents.
Even though flex-basis
is set to 0px
, as far as I understand setting flex-grow
to 1
(first number in flex
shorthand) should make the item grow, when needed.
In my example .bottom-container
has height
set to 300px
. That height
is respected on Firefox, but collapsed to 0px
on Chrome. Why?
.top-container {
display: flex;
flex-flow: column nowrap;
}
.middle-container {
flex: 1 0 0px;
display: flex;
flex-flow: column nowrap;
}
.bottom-container {
flex: 0 0 auto;
height: 300px;
}
<div class="top-container">
<div class="middle-container">
<div class="bottom-container"></div>
</div>
<div class="middle-container">
<div class="bottom-container"></div>
</div>
</div>