CSS Safari 更改选择高度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13252835/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Safari change select height
提问by Wizard
I can't change select
height
, with all browser working fine, but Safari no, where can be problem? Also I try make class .style select
, but not working.
我无法更改select
height
,所有浏览器都可以正常工作,但 Safari 不行,哪里有问题?我也尝试 make class .style select
,但不起作用。
select {
width: 170px;
height: 25px;
}
采纳答案by Iwaz
Try adding this:
尝试添加这个:
-webkit-appearance: menulist-button;
回答by Marjan Stanojevic
To style a select in Safari, you first have to turn off the os styling:
要在 Safari 中设置选择的样式,您首先必须关闭 os 样式:
-webkit-appearance: none;
回答by hobailey
You can also use
你也可以使用
line-height: 25px
which doesn't affect other browsers, but fixes this bug in Safari
这不会影响其他浏览器,但修复了 Safari 中的此错误
回答by Sanjib Debnath
The best way use modernizer detector and give safari class select menu a
最好的方法是使用现代检测器并给 safari 类选择菜单一个
line-height: 20px;
or you can use jquery UI select menu to solve this by another cross-browser wy.
或者您可以使用 jquery UI 选择菜单通过另一个跨浏览器 wy 解决此问题。
回答by DziNeR dAsS
@media screen and (-webkit-min-device-pixel-ratio:0) {
select {
-webkit-appearance: menulist-button !important;
line-height:24px !important;
}
}
This code ensures the same height across browsers.
此代码可确保跨浏览器具有相同的高度。
回答by bortunac
at least on iPad the select is not rendered for padding or line-height but instead will render given height and center vertically the value
至少在 iPad 上,不会为填充或行高呈现选择,而是将呈现给定的高度和垂直居中的值
select {
-webkit-appearance:menu-item; // or menulist-button
-moz-appearance:menu-item;
height:2.4em; // this must be calculated to match other input types
}
input[type="text"], select {
min-width:12em;
border-radius:5px;
}
the only thing unresolved now is background which is predefined and imutable
现在唯一未解决的是背景,它是预定义且不可变的
回答by Sergey Lost
Nothing worked for me until I used inline style:
在我使用内联样式之前,没有什么对我有用:
<select name="pickupsel" id="pickups" style="line-height:33px">
Somehow Safari (latest Windows version, 5.1.7) doesn't read this style property from CSS file.
不知何故,Safari(最新的 Windows 版本,5.1.7)不会从 CSS 文件中读取此样式属性。
回答by user3815518
@media screen and (-webkit-min-device-pixel-ratio:0) { select { -webkit-appearance: menulist-button !important; line-height:24px !important; } }
Give line-height
according your requirement.
line-height
根据您的要求给予。