Search code examples
htmlhtml-select

Height of an HTML select box (dropdown)


Can someone confirm that its not possible to change the height of a dropdown that is shown when you click on a select box.

The size attribute of the select makes it look like a list, the height attribute in the CSS doesnt do much good either.


Solution

  • Confirmed.

    The part that drops down is set to either:

    1. The height needed to show all entries, or
    2. The height needed to show x entries (with scrollbars to see remaining), where x is
      • 40+ in Firefox (used to max at 20, but now will render until the list hits the top or bottom of the OS window)
      • 20 Chrome (likely all Chromium browsers)
      • 20 in Microsoft Edge (Chromium based)
      • 30 in IE 6, 7, 8, 9, 10, 11
      • 16 for Opera 10
      • 14 for Opera 11
      • 22 for Safari 4
      • 18 for Safari 5
      • 11 in IE 5.0, 5.5
    3. In IE/Legacy Edge, if there are no options, a stupidly high list of 11 blanks entries.

    For (3) above you can see the results in this JSFiddle