min-height: max-content;
Hi,
I would like to understand why min-height:max-content does not work in the following example (container2 overflows main when window height is reduced).
I know that a corresponding example in inline direction would work (min-width: max-content), but why doesn't it work in block direction? There is a stackoverflow question about this (https://stackoverflow.com/questions/63740508/what-does-min-height-max-content-mean), but since height:max-content would work as intended for main in the code below, I think it has nothing to do with an "incorrect" calculation of max-content.
Does anyone know why this isn't working?
Thanks in advance
Stack Overflow
What does
min-height: max-content
mean?Why is the height of the parent 200px instead of 300px in the following example?
#p {
height: 200px;
min-height: max-content;
border: 1px solid blue;
}
#c {
margin: 0 50px 0 50...
2 Replies
I didn’t try running your code but I’d say it’s because your inner divs have a fixed height.
What exactly are you trying to achieve?
Are you wanting
main
to stop shrinking and the body to scroll if the window height is too small?
If so, I added / changed the following CSS:
Also you don’t need flex-direction: row
as that’s the default with flexbox.Thank you for your answer. I just tried to understand why min-height:max-content isn't working in the example above.