Select option padding not working in chrome
<style> select option { padding:5px 0px; } </style> <select> <option>1</option> <option>2</option> <option>3</option> </select>
For vertical padding you can use line-height. If you don't need border, you can specify border and make it the same color as the select element background, it will give you padding appearance. box-shadow can be used to add stroke to the element if really needed.
There are many ways to design a <select> dropdown menu using CSS. The Dropdown Menu is mainly used to select an element from the list of elements. Each menu option can be defined by an <option> element that can nested inside the <select> element.
You can also link to another Pen here (use the . css URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
I just found a way to get padding applied to the select input in chrome
select{ -webkit-appearance: none; -moz-appearance: none; appearance: none; padding: 5px; }
Seems to work in the current chrome 39.0.2171.71 (64-bit) and safari (I only tested this on a mac).
This seems to remove the default styling added to the select input (it also removed the drop down arrow), but allows you to then use your own styling without chrome overriding it.
I stumbled across this fix while using code from here: http://fettblog.eu/style-select-elements/
This simple hack will indent the text. Works well.
select { text-indent: 5px; }
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