tonyleMill tonyleMill - 9 months ago 34
HTML Question

How to create HTML drop-down with all options showing by default?

I guess it's not really a drop-down but it looks like a drop-down with all the values "selected" or viewable on page-load. I am not sure of the correct HTML to create it. Here's a picture.picture


You're looking for the size attribute of the select element.

If the value of the size attribute is greater than 1, then all options are displayed in a scrollable pane. Otherwise you get the classic dropdown.

<select size="5">
  <option>Report A</option>
  <option>Report B</option>
  <option>Report C</option>
  <option>Report D</option>

Alternatively, you can use the multiple attribute which will set size to a default value of 4.