Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Size of drop down box on select element

Tags:

html

css

select

How do you set the size of the drop down box on a select element? Not the select element itself but the drop down box part of it when you click for options?

______________
|____________| input box
|            |
|            |
|            |
|____________| size of drop down box containing options

Thank you for your help!

like image 601
nick Avatar asked Feb 26 '23 19:02

nick


2 Answers

If you just want to change the size to increase the number of options displayed, use HTML like: <select size="3" ... .

But if you want to change the "pop-up" size, than as others have said, you can't do this with CSS.

The best workaround is to use one of the many jQuery plugins. See this answer.

like image 93
Brock Adams Avatar answered Mar 02 '23 19:03

Brock Adams


This can't be done with a standard SELECT element. Support for styling SELECT and OPTION is very limited.

You can use a bit of scripting to replace the SELECT with an UL, that you can style perfectly. Checkout http://v2.easy-designs.net/articles/replaceSelect/ or http://v2.easy-designs.net/articles/replaceSelect2/ for examples.

like image 34
Konerak Avatar answered Mar 02 '23 19:03

Konerak