views:

97

answers:

1

I have this Code For example:

<select >
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
  <option value="audi">Audi</option>
<option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option>
</select>

Its drop down is too long for me. Is it possible to set the height for the drop down. like setting it to 4 then if the entries are greater that four, the scrollbar will show.

+2  A: 

I do not believe there is a way to do this as it is part of the browser specific rendering. If you look on different operating systems, the dropdown box displays with a different look and feel, and I believe that the number of entries shown before having a scroll bar is a part of that look and feel.

I know this question has came up before, and unfortunately I cannot find it in the archives, however I believe that you cannot edit the number of entries before a scrollbar appears.


Found another question that confirms this: http://stackoverflow.com/questions/1096182/change-style-of-scrollbar-in-dropdownlist-in-asp-net

Chacha102
even in css cant control it??
Treby
Correct. Here is another question similar that confirms this: http://stackoverflow.com/questions/1096182/change-style-of-scrollbar-in-dropdownlist-in-asp-net
Chacha102
I believe the only browser that allows you to style those boxes at all is IE. However it is not in the CSS standard, so it is not assured to work.
Chacha102
with this example. http://www.dfc-e.com/metiers/multimedia/opensource/jqtransform/can you extract for the code for select(with long words). or similar to that
Treby
IE is the browser that provides least styling possibilities for select boxes. There is very little styling you can do, mostly just fonts. To do anything more you have to replace the whole lot with scripted divs like the above plugin does. However this approach can have accessibility and usability drawbacks as the resultant controls don't respond properly to all the forms of mouse and keyboard interaction a real select box would.
bobince