3
votes

I would like to scroll within a div whose height extends below the browser window without scrollbars appearing on the browser window.

When I add an overflow:hidden style on the body tag this works as long as the div height is < the window height. How can I get the same effect when div height > browser window height?

1

1 Answers

3
votes

Is the div height greater than the window height because you have set it that way in css or is there just a lot of content inside the div?

If you have already set its height in css, you might have to wrap it in another div first. Otherwise, try this:

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

div {
    height: 100%;
    width: 50%;
    overflow-y: scroll;
}

Example