I'm trying to build a navigation panel which has a fixed-height primary navbar at the top, a fixed-height secondary navbar fixed to the bottom of the screen, and a container in between which fills the remaining space and is scrollable depending on the length of the list of items inside.
I'm learning to use flexbox
and thought I could use flex-grow and overflow: hidden to accomplish this, however I'm running into some trouble.
html,
body {
height: 100%;
}
.container-main {
display: flex;
height: 100%;
flex-flow: column;
}
.nav-bar {
display: flex;
height: 36px;
background-color: grey;
}
.container-dd {
height: 100%;
display: flex;
flex-flow: column;
}
.dd-fill {
display: flex;
flex-flow: column;
flex: 1 1 auto;
background-color: green;
overflow: hidden;
}
.dd-bot {
display: flex;
height: 100px;
}
<div class="container-main">
<div class="nav-bar">top nav bar</div>
<div class="container-dd">
<div class="dd-fill">
<p>list item</p>
<p>list item</p>
<p>list item</p>
<p>list item</p>
<p>list item</p>
<p>list item</p>
<p>list item</p>
<p>list item</p>
<p>list item</p>
</div>
<div class="dd-bot">sticky footer</div>
</div>
</div>
You can see from the fiddle that the content that doesn't fit inside the div dd-fill is inaccessible and there's no scrollbar. Also the fixed height of the secondary navbar is not being enforced. Does anyone know why it's behaving like this? Thanks in advance.