having a scrollbar without setting height
On mobile, when the menu opens, it overflows the screen size. Setting
overflow-y: scroll
doesnt work unless I set height: 100vh
, which I cant do because it still takes effect when the menu is closed (the element is still visible, but not expanded).
Is there a solution that doesnt require js?3 Replies
I dont even understand why the body is still scrollable when its fully covered by the header/menu
I figured how to solve all my problems:
max-height
instead of height
for the height problem and overflow-behaviour: contain
for the scrollable body problem!
But now I have to ask: is there a way to let a children overflow the parent that has overflow-y: scroll
?This is one of those pretty annoying things to deal with when you run into it, but the only way (that I can think of right now anyway) is if the child is
position: fixed
.fixed
works, thanks. Do you know a trick to rearrange the child to the position it had without fixed
?
Oh! I just removed the left
property at all. I think I can make it work with translateX()