Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply CSS to a Mac Chrome Select Box?

Doesn't matter what I do, using Mac OSX 10.9.2 and Chrome Version 33.0.1750.152, padding, background-color, nothing works. I am really just wanting to apply a padding-top and padding-bottom of 5px on a select element, works everywhere cept Chrome on a MAC OSX. What gives? How to do this globally on all platforms??

like image 897
Solomon Closson Avatar asked Apr 13 '14 07:04

Solomon Closson


4 Answers

You need to apply -webkit-appearance:none; when adding CSS to select elements in webkit browsers.

DEMO http://jsfiddle.net/XxkSC/3830/

like image 196
Kevin Lynch Avatar answered Oct 06 '22 07:10

Kevin Lynch


There is better option to achieve a natural design:

height:30px;
background:#ffffff;

DEMO JSFiddle

p.s

Vector's answer is hiding the arrows on the right side.

like image 30
Almog_0 Avatar answered Oct 06 '22 09:10

Almog_0


Add the following property to your select in your css file:

-webkit-appearance:none;
like image 3
pconnor88 Avatar answered Oct 06 '22 07:10

pconnor88


If you are using bootstrap, you can add class custom-select:

<select class="form-control custom-select">

After adding it, you can eventually adjust height by adding line-height property to css:

select {
    line-height: 1.3;
}

https://getbootstrap.com/docs/4.1/components/input-group/#custom-select

like image 2
Marko Milivojevic Avatar answered Oct 06 '22 08:10

Marko Milivojevic