Reputation: 401
I have dropdown with more than 100 option with default 20 option is shown for remaining we need to scroll.
I need to decrease the option as 10 instead of 20. I have used size parameter in select tag it display like below
I need display like dropdown can any one help me to fix this problem.
Thanks,
Upvotes: 2
Views: 1563
Reputation: 2572
Having a size
option for an select element means it will show only the number of options you put in size
property.
For displaying only 20 you can use css tricks.
Give the height to the dropdownlist and then make it as much height as you can able to show the options you want.
Hope this helps.
Upvotes: 0
Reputation: 1304
Check this
<select name="numbers" size="5">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
</select>
Upvotes: 1
Reputation: 148150
You can use size property of select to limit the visible elements
<select size="10">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
If the control is presented as a scrolled list box, this attribute represents the number of rows in the list that should be visible at one time. Browsers are not required to present a select elements as a scrolled list box. The default value is 0, Reference.
Upvotes: 1