I am struggling to make a div inside a flex box item take up 100% height. Here is the current setup:
#outer (display: fled, flex-direction: column, height: 100px)
#header (height: auto)
#middle (flex-grow: 1)
#inner (height: 100%)
The goal is for #inner
to occupy the full remaining height of #outer
. Essentially, I want the red section to completely cover the green section in the example 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>
Browser rendering varies with Firefox and IE showing the desired layout while Chrome behaves differently. In Chrome, it seems as if #inner
has height: auto
.
How can I resolve this issue to work uniformly across all browsers, especially in Chrome without compromising on using flexbox?