gpt4 book ai didi

css - 如何更改 Bootstrap 3 选中的选项背景颜色

转载 作者:行者123 更新时间:2023-11-28 09:00:20 24 4
gpt4 key购买 nike

你能看看This Demo吗?并让我知道如何将所选选项的背景颜色从蓝色更改为其他颜色?

<select class="form-control">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>

谢谢

最佳答案

看看这个:

http://jsfiddle.net/xL4Gu/3/

select{
background: yellow !important;
color:#FFF;
text-shadow:0 1px 0 rgba(0,0,0,0.4);
}
option:not(:checked) {
background-color: white;
color:#000;
}

使用 !important 覆盖 Bootstrap CSS。

!important 是一个有用的工具,但缺点是它是一种不得已的工具。因此,您不希望过度使用它,因为这最终会给维护网站的任何人带来麻烦。

关于css - 如何更改 Bootstrap 3 选中的选项背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24346956/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com