Using CSS max-height on an outer div to force scroll on an inner-div.
Posted
by Jay Neely
on Stack Overflow
See other posts from Stack Overflow
or by Jay Neely
Published on 2010-04-27T17:44:10Z
Indexed on
2010/04/27
18:13 UTC
Read the original article
Hit count: 304
I have an outer div with a variable height (and max-height) that's set with a specific pixel amount by JavaScript, containing two divs within.
- The 1st div is intended to hold a variable amount of content, e.g. a list of links. It has no height set.
- The 2nd div is intended to hold a fixed amount of content, and has a specific height set.
Right now, the max-height isn't working. The 1st div keeps growing, even with overflow: auto; set, and pushes the 2nd div below it outside the bounds of the outer div. How can I make it so that when the 1st div gets too large for the outer div to contain both it and the fixed-height 2nd div, the 1st div will start to scroll?
Example page: http://thevastdesign.com/scrollTest.html
Thanks for any help. I'd appreciate a CSS solution the most, even if it requires some hacks. It only has to work in Firefox 3+, IE8, and IE7.
Ideas?
© Stack Overflow or respective owner