D
D
David Halkin2022-02-01 03:47:09
css
David Halkin, 2022-02-01 03:47:09

How to solve max-height and flex-column issue?

Hello connoisseurs! )

https://codepen.io/northfire/pen/xxPZQOw

The main parent can and will overflow. It needs to have a max-height , but at the same time, when the overflow starts, it should appear in .content - scroll. Currently it only works when the parent has a fixed height . Are there any ideas how to keep the "rubbery" in height, but at the same time, when overflowing, what would be the scroll?

PS> the issue has been resolved for grids (thanks for the solution!). but you can use flex (there is a small bug in ff) https://codepen.io/northfire/pen/xxPZQOw

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Ankhena, 2022-02-01
@northfire

So what's the attack?
No need to do this with absolutes
https://qna.habr.com/q/1107394
https://qna.habr.com/q/1102624

D
Danny Arty, 2022-02-01
@DanArst

You either have to set the height anyway , or use position: relative and position:absolute for the respective blocks.
Because in the current case, the height of the outer block, i.e. .test is calculated from its content, so setting the height to % for its child blocks will not work - it will automatically be considered as height: auto .

V
Vyach Gor, 2022-02-01
@sharnirio

Not so long ago, I came across a rather interesting and non-obvious method for solving a similar issue

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question