So how can I change how many rows a select tag with multiple enabled should be showed:
<select multiple="multiple">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
This will only show the first four options how can I show the fifth without have to scroll?
The same way as any other element. You write a selector that matches the element (e.g. a select element with a multiple attribute) and then use the width property. Width applies by default to replaced inline elements (such as selects). Save this answer.
For windows: Hold down the control (ctrl) button to select multiple options. For Mac: Hold down the command button to select multiple options.
It is not possible to limit the number of visible elements in the select dropdown (if you use it as dropdown box and not as list). But you could use javascript/jQuery to replace this selectbox with something else, which just looks like a dropdown box. Then you can handle the height of dropdown as you want.
Use the size
attribute:
<select size="5" multiple name="whatever">
References:
<select>
element.You can use CSS to specify the exact height, but this will probably not render exactly the same across all browsers due to different rendering of the select:
<select multiple="multiple" style="height: 24pt"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select>
Fiddle: http://jsfiddle.net/24Myw/
<select size="any number" name="#" id="#">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
it working well
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With