Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

limiting select box list length - adding scrollbars

Tags:

html

css

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?

like image 576
tomermes Avatar asked Apr 08 '11 09:04

tomermes


People also ask

How do I add a scrollbar to a list?

Drag the list object into the block. Select the block and in the properties pane, select "Size and Overflow". In the "Size and Overflow" window, set the desired dimensions of the block. Select the "Always use scrollbars" radio button.

How do I limit the size of a drop down list in HTML?

When the number of options in a drop-down list is large, fixing the number of visible items may be useful. This can be done by using the “size” attribute of <select> tag.

How do I add a scrollbar to a drop down list in HTML?

Put your list inside a DIV tag and set the DIV style overflow:auto and the DIV's height to a fixed height.


1 Answers

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!

like image 53
Khez Avatar answered Sep 26 '22 13:09

Khez