我已经建立 了这个小提琴 作为我正在做的事情的例子。
我正在尝试做的事情在 Firefox 中运行良好。当您打开选择选项时,字体大小为 14px 。
但是在谷歌浏览器中查看它会选择继承的字体大小 34px 。
我理想地寻找字体大小为 14px 的选择选项。
这可能吗?
如果需要,我愿意在 jQuery 中进行任何相关修复。
谢谢
下面列出的代码……
.styled-select {
overflow: hidden;
height: 74px;
float: left;
width: 365px;
margin-right: 10px;
background: url(http://i50.tinypic.com/9ldb8j.png) no-repeat right center #5c5c5c;
}
.styled-select select {
font-size: 34px;
border-radius: 0;
border: none;
background: transparent;
width: 380px;
overflow: hidden;
padding-top: 15px;
height: 70px;
text-indent: 10px;
color: #ffffff;
-webkit-appearance: none;
}
.styled-select option.service-small {
font-size: 14px;
padding: 5px;
background: #5c5c5c;
}
<div class="styled-select">
<select class="service-area" name="service-area">
<option selected="selected" class="service-small">Service area?</option>
<option class="service-small">Volunteering</option>
<option class="service-small">Partnership & Support</option>
<option class="service-small">Business Services</option>
</select>
</div>
原文由 StuBlackett 发布,翻译遵循 CC BY-SA 4.0 许可协议
一种解决方案是将选项包装在 optgroup 中: