How to set height for dropdown box

my selectbox shows scrolling when the number of options is more than 20, I just want to show scrolling when the 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> 
+8
html css
source share
5 answers

Try adding this to the <select> :

 onfocus='this.size=10;' onblur='this.size=1;' onchange='this.size=1; this.blur(); 

as:

  <select onfocus='this.size=10;' onblur='this.size=1;' onchange='this.size=1; this.blur();'> 

SAMPLE DEMO

+13
source share

Seriously guys, there is a size attribute for select-tag.

 <select size="10"> <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> 

FIDDLE: http://jsfiddle.net/UR46N/

+5
source share

Why don't you add a CSS style to indicate the width and height of the selection. Check the article → http://cssdeck.com/labs/styling-select-box-with-css3

+1
source share

check this .i have embedded scrolling in the selection box. http://plnkr.co/edit/XiKZ4X2DGYTJDjJX2xvw?p=preview

0
source share

use below css

 select{ padding:5px;} 
0
source share

All Articles