I want to give a div inside a flex box item 100% height, but I can't get it to work. The situation is as follows:
#outer (display: fled, flex-direction: column, height: 100px)
#header (height: auto)
#middle (flex-grow: 1)
#inner (height: 100%)
I want #inner
to span the full remaining height of #outer
. Basically, I want the red part to cover all of the green part in the fiddle below.
#outer {
height: 100px;
display: flex;
flex-direction: column;
}
#header {
height: auto;
}
#middle {
flex-grow: 1;
background-color: green;
}
#inner {
height: 100%;
background-color: red;
}
<div id="outer">
<div id="header">
Header
</div>
<div id="middle">
<div id="inner">
This should be full height.
</div>
</div>
</div>
Different browsers seem to deal with this differently:
- Firefox and IE displays it the way I want it, with all of
#middle
red, no green visible. - Chrome renders it like if
#inner
hadheight: auto
.
How can I fix this so it works on Chrome as well? Preferably I don't want to abandon the flexbox.