Is there a way to have two <div> containers, one having a static height, and a second underneath dynamic, basically just takes up the remaining portion of the viewport?
Inside the the dynamic container, if there is overflow within, the container itself would show scrollbars accordingly. That way the viewport should ever need a y-axis scrollbar.
Any ideas? Would it require a lot of scripting or could it be done purely with css?
I would do it like this: http://jsfiddle.net/tw16/X5rWb/
CSS:
jQuery:
The 2 in
windowHeightcomes from adding the 1px top and 1px bottom border of the.contentdiv together.Using
outerHeight()for the.headermeans there is no need to make any additions as the top and bottom padding and borders are included. If you were to useouterHeight(true)this would also include the top and bottom margin.