5

When i use an html select box which has about 50 items, I get a very long list that fully appears. I would like to use scrollbars instead. how do I do that?

Khez
  • 10,172
  • 2
  • 31
  • 51
tomermes
  • 22,950
  • 16
  • 43
  • 67

3 Answers3

14

You need to use CSS, specifically height and overflow:

CSS

.select{
    height:100px;
    overflow:scroll;
}

HTML

<select class="select"></select>

If you need anything more specific, ask!

Khez
  • 10,172
  • 2
  • 31
  • 51
4

It is not possible to do this in HTML. See Height of an HTML select box (dropdown)

There are other ways of achiving this though javascript or jQuery, with links on that page to some jQuery plugins which create a "fake" html select box that looks and behaves like one, but can have the height set.

Community
  • 1
  • 1
devrooms
  • 3,119
  • 19
  • 24
1

It is not possible to set the number of visible items for a single value select box. There is a size attribute, but that will transform the dropdown into multiple selection list.

Corneliu
  • 2,932
  • 1
  • 19
  • 22