tags:

views:

88

answers:

1

If, for example, I have a menu using fixed positioning but it's larger than the height of the current window, is there a way to allow this to scroll? The browser's default behaviour is to just hide it, and not let you access it.

div#sidebar {
    position:fixed;
    top:30px;
    left:0;
    bottom:4px;
    width:148px;
    background-color:#d7d7d7;
}

Here's a snippet of what I've currently got. Would it require some JavaScript or something along those lines?

EDIT: I'm not sure if this is actually possible to get correct. I want an element which is 30 pixels from the top of the document. I want to allow this to scroll using overflow:auto and height:100%. Either way I seem to do it, the scrollbar will be hidden, or a portion of the div will be hidden.

+1  A: 

You'll need to set overflow:scroll (or overflow:auto) to that div, and set height to 100%.

Seb
That'd work fine, however with top:30px set the scrollbars won't display correctly. Would I have to contain this div within another div. Have fixed position on the outer div and something else on the inner div?
Kezzer
Yeah, that should work. Set an inner div with your content, set the outer div with padding-top: 30px and get rid of top: 30px :)
Seb