【发布时间】:2018-09-18 08:45:21
【问题描述】:
我正在尝试设置 boostrap-select 小部件的样式,但失败了。我尝试了以下代码,但它不会更改 selectpicker 选择框中的背景和文本颜色:
<select id="what" class="wia-filter-value selectpicker show-tick">
<option selected>All</option>
<option>Events</option>
<option>Man Made</option>
<option>Nature</option>
</select>
我的 CSS 如下所示:
select {
width: 200px;
height: 30px;
background-color: #141414 !important;
border-style: solid;
border-left-width: 3px;
border-left-color: #00DDDD;
border-top: none;
border-bottom: none;
border-right: none;
color: white;
font-size: 18px;
font-weight: 200;
padding-left: 6px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.selectpicker{
width: 200px;
height: 30px;
background-color: #141414 !important;
border-style: solid;
border-left-width: 3px;
border-left-color: #00DDDD;
border-top: none;
border-bottom: none;
border-right: none;
color: white;
font-size: 18px;
font-weight: 200;
padding-left: 6px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
select::-ms-expand { /* for IE 11 */
display: none;
}
.wia-filter-value {
width: 200px;
height: 30px;
background-color: #141414 !important;
border-style: solid;
border-left-width: 3px;
border-left-color: #00DDDD;
border-top: none;
border-bottom: none;
border-right: none;
color: white;
font-size: 18px;
font-weight: 200;
padding-left: 6px;
}
此 CSS 成功应用左边框颜色,但不应用背景颜色或文本颜色。
注意:enter link description here 的 stackoverflow 中显示的解决方案适用于标准 Boostrap 选择。我正在使用来自https://silviomoreto.github.io/bootstrap-select 的选择器小部件。该解决方案似乎不适用于 selectpicker,或者至少我无法让它工作。
【问题讨论】:
标签: css twitter-bootstrap