I know I can give a {max-height} and {overflow: auto}. But I want the max-height to be dynamic and not fixed.
Lets say that we have 2 divs on a page, if div#1 is hidden the max-height of div#2 should increase so that it occupies the maximum area before scrolling, and scrolls only when it goes out of the viewport.
Sample jsbin: http://jsbin.com/voworuveqe/edit?html,css,js,output
Edit
Please CSS solutions only. No JS. Thank you!