user1022521
user1022521

Reputation: 537

Add a scrollbar to the inner div (nestd divs)

http://jsfiddle.net/9Sjvm/

I am trying to put a scroll bar and also limit the height of the <div id="items"> to 2 rows, right now it keeps increasing with the number of <span>s in it. Tried adding overflow:scroll to inner divs but none of them works, any workaround for this particular structure? The number of <span>s is dynamic and it can grow.

Upvotes: 0

Views: 60

Answers (1)

JunM
JunM

Reputation: 7150

overflow: auto works just fine. You just need also to add max-height on on your #items

Fiddle

#items {
    //display: none;
    margin-top: 24px;
    position: relative;
    overflow: auto;
    border: 1px solid red;
    height: auto;
    max-height:100px;
}
.item1 {
    display: block;    
}

Upvotes: 1

Related Questions