Quantcast
Viewing all articles
Browse latest Browse all 43

Prevent Y scrollbar on parent and adding scrollbar to child

I have a parent that is used as a React component and has a scrollbar, I cannot change the parent but in a certain case I'd like the parent not to display the scrollbar and instead have the child scroll while taking up all the vertical space that is available.

<div id="parent" style="overflow: auto;"><h1>Hello world</h1><div id="child" style="overflow-y: auto; height: 600px;"><div style="height: 1200px; background-color: green;"></div></div></div>;

I can prevent the div with id parent to show a scrollbar but only know how to by setting div with id child to have a fixed height, how could this be accomplished with child taking up the rest of the height of the page?


Viewing all articles
Browse latest Browse all 43

Trending Articles