Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Set Height for the Drop Down of Select box

Tags:

html

css

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> 
like image 575
Atif Azad Avatar asked May 08 '14 06:05

Atif Azad


People also ask

How do I increase the height of a drop down box in HTML?

You just need to use the height CSS attribute for the select tag.

How do I change my drop down position?

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 ).

How do I increase the size of a drop down box?

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.


1 Answers

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

like image 84
reuelab Avatar answered Sep 26 '22 18:09

reuelab