Question

I'm want to add a vertical scrollbar to a section of my webpage if its content grows too big but a grayed-out scrollbar shows up even when the content is small enough to fit. What do I need to change to make the scrollbar show only when its needed?

Example code:

<div id="aaa">
</div>

#aaa {
    background-color: #eee;
    width: 50px;
    height: 100px;
    overflow-y: scroll;
}

Result screenshot:

enter image description here

JSFiddle link with live example:

http://jsfiddle.net/PGwg3/

Was it helpful?

Solution

This will work

overflow-y:auto;

OTHER TIPS

Change the property overflow-y: scroll to overflow-y: auto

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top