View Full Version : Scrolling Div

01-24-2009, 10:27 AM
Hi there,

Let me start by explaining what I'm trying to achieve:

My layout has a header, main nav, left sidebar and content section. I would like nothing but the content to scroll. In other words, I don't want the nav and sidebar to scroll out of view.

I have been able to manage it by constraining the height of the content div and setting the overflow to auto. All is well on a small screen, but on a bigger screen the constrained content div looks a bit lost and silly.

Is there a way to have the content div expand vertically according to the screen size and still being able to have it scrolling?


01-24-2009, 02:57 PM
Yes, though it can be tricky.

You can use min-height and max-height in your css.

The tricky part is getting IE6 and under to follow these rules as they don't understand min-height or max-height.

01-24-2009, 03:00 PM
Great stuff!
At least I've got somewhere to start from now.


01-24-2009, 03:06 PM
Heres one I have bookmarked to help you get started.