3

how is putting line-height: 40px; for option in select box?

<select class="select_box">
    <option value="" disabled="disabled" style="display: none;">Categories</option>
    <option>10</option>
    <option>25</option>
    <option>50</option>
    <option>100</option>
    <option>all</option>
</select>
Kimberly Mullins
  • 101
  • 2
  • 4
  • 8

3 Answers3

1

It is not possible to alter a select list in this way. You can add padding but it is not reliable in various browsers. To alter the look and feel of a select list reliably you will need to use javascript.

Here is one method : http://www.filamentgroup.com/lab/jquery_ui_selectmenu_an_aria_accessible_plugin_for_styling_a_html_select/

Boz
  • 1,178
  • 1
  • 12
  • 26
0

<html>
 <head>
  <style>
   option {font-size: 40px;}
  </style>
 </head>
 <body>
  <select>
   <option>Internet Explorer 11</option>
   <option>Mozilla Firefox 38.0.5</option>
   <option>Opera 30.0.1835.125</option>
   <option>Google Chrome 43.0.2357.81 dev-m</option>
  </select>
 </body>
</html>
  • You can not add a font size to options in a select. The styling of the select options is handled by the browser – jmona789 Jan 22 '20 at 21:20
0

Try this :

.select_box{font-size:12px;padding:14px;}

Demo : http://jsfiddle.net/dk9p2/

Or you can change the font-size:

.select_box{font-size:30px;}

More options here.

Note It all depends on the browser. The previous doesn't work in < ie8

UPDATE : Little more can be achieved through css alone : http://jsfiddle.net/dk9p2/1/

jmona789
  • 2,711
  • 6
  • 24
  • 57
Sparkup
  • 3,686
  • 2
  • 36
  • 50