I'm using a flexbox
to make a div take up the remaining vertical space in the browser window, but I'd like to prevent it from expanding beyond that. When its contents exceed its vertical size, I'd like a scrollbar to show up in the flexbox child that is now too small.
Is this possible? Or is there some other layout technique I should be using for this?
Here's a link to a JSFiddle to show the situation: https://jsfiddle.net/83990d3a/
The other vertical space is taken up with a toolbar, the exact vertical size of which is not known beforehand.
To override this behavior, use min-width: 0 or overflow: hidden .
The flexbox code is triggered on the parent element, but affects all of the child elements.
One of the major drawbacks of using flexbox is performance issues. The use of flexbox can increase the page loading time if you have a larger project. You can compare the page loading time through Chrome development tools using the flexbox and the same pages constructed without using flexbox.
Just add overflow: auto
to #content
(updated fiddle):
#content {
background-color: #ceecf5;
flex-grow: 1;
overflow: auto;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With