How to properly stretch a child to parent's height? I've tried a lot of variants I found (many quite complicated), but it never worked for me. I would prefer to do this with flex-box, as that seems the newest method. Here is my try:
<div class="main h-100">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a href class="navbar-brand">Menu</a>
</nav>
<div class="container-fluid h-100">
<div class="row h-100">
<div class="col-xs-2 bg-light h-100 pr-3 menuContainer">
<button class="btn btn-outline-primary mt-3 btn-sm btn-block"> Test </button>
<nav class="navbar navbar-light list">
<ul class="navbar-nav flex-column">
<li class="nav-item"><a href="#" class="nav-link">A1</a></li>
<li class="nav-item"><a href="#" class="nav-link">A1</a></li>
</ul>
</nav>
</div>
<div class="col-xs-10 p-0">
Content
</div>
</div>
</div>
body {
height: 100vh;
}
.bg-light {
background-color: green !important;
}
.list {
overflow-y: auto;
height: 100%;
align-items:start
}
.menuContainer {
display: flex;
flex-flow: row wrap;
}
.list {
flex: 1;
background-color: red;
}
http://jsfiddle.net/x1hphsvb/2065/
In the end I'd like to remove the scroll, so that the menu (red box) starts where it starts now and ends exactly where the screen end is.
The aim is also to be able to put anything instead of Content
with height: 100%
so it does the same.
Both content and menu can be bigger - in that case I expect them to add a scroll on it's own - I use overflow-y: auto
for that.