Reputation: 2692
Ok so i have a div that acts as a background for two divs(filled with text) that are nested inside this div. Only one of these two divs are shown at one time (toggled by a button) since these divs vary in size, the div grows to accommodate the text. But i want the div to stop growing beyond 343 and since overflow:auto is already applied to the div, the content would become scrollable. but this is not happening, the toggle works perfect but the div just grows to an enormous size, rather than stopping at 343px. heres the fiddle: http://jsfiddle.net/7Az3D/
Upvotes: 0
Views: 415
Reputation: 8532
You can use the css2 max-height property to restrict the height of the div and show scrollbars if content extends that height.
That IS THE MOST ROBUST way to get this done and IMO the right way to do it.
Upvotes: 1
Reputation: 19740
Whichever div you don't want to grow, just give it a max-height property. Eg:
max-height: 343px;
Upvotes: 1