How to apply CSS to a Mac Chrome Select Box?

我与影子孤独终老i 提交于 2019-12-03 10:45:18

问题


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??


回答1:


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

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




回答2:


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.




回答3:


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

-webkit-appearance:none;



回答4:


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



来源:https://stackoverflow.com/questions/23040305/how-to-apply-css-to-a-mac-chrome-select-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!