I faced the same challenge myself and found these 2 answers using flex properties.
CSS
.container {
display: flex;
flex-direction: column;
}
.dynamic-element{
flex: 1;
}
- https://stackoverflow.com/a/35348188/1084619
- https://stackoverflow.com/a/35348188/1084619