my selectbox is showing scroll when number of options are more than 20 i just want to show scrol in when options are more than 10
<select> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> </select>
You just need to use the height CSS attribute for the select tag.
Wrap a <div> element around the elements to position the dropdown content correctly with CSS. CSS) The . dropdown class uses position:relative , which is needed when we want the dropdown content to be placed right below the dropdown button (using position:absolute ).
Create a css and set the value style="width:50px;" in css code. Call the class of CSS in the drop down list. Then it will work.
Try adding this to the <select>
element:
onfocus='this.size=10;' onblur='this.size=1;' onchange='this.size=1; this.blur();
like:
<select onfocus='this.size=10;' onblur='this.size=1;' onchange='this.size=1; this.blur();'>
SAMPLE DEMO
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