CSS 如何在引导选择中更改背景颜色选项?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39661592/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 12:08:50  来源:igfitidea点击:

How to change background-color option in bootstrap-select?

cssbootstrap-select

提问by Cooxkie

I'm using bootstrap-select (from Silvio Moreto). I would like to change background-color and font color of list item. By default is :

我正在使用引导程序选择(来自 Silvio Moreto)。我想更改列表项的背景颜色和字体颜色。默认情况下是:

enter image description here

在此处输入图片说明

And I would like something like :

我想要类似的东西:

enter image description here

在此处输入图片说明

I tried this, but nothing change :

我试过这个,但没有任何改变:

.bootstrap-select.btn-group .dropdown-menu li:hover{
      background-color: rgb(191, 82, 121);
      color: white;
}

Any idea ?

任何的想法 ?

回答by Cooxkie

I answered my own question :

我回答了我自己的问题:

 .bootstrap-select.btn-group .dropdown-menu li a:hover {
     color: whitesmoke !important;
     background: #bf5279 !important;
 }

Thanks ;-) !

谢谢 ;-) !

回答by Stefan Vilbrandt

Without a demo or live-site my only guesses would be to either use "!important" on background-color or check if your css selector ist right. What happens, if you change outline or border? If nothings happens, i would think, that your selector is wrong or your css isn′t even included.

如果没有演示或实时站点,我唯一的猜测是在背景颜色上使用“!重要”或检查您的 css 选择器是否正确。如果更改轮廓或边框会发生什么?如果什么也没发生,我会认为,您的选择器是错误的,或者您的 css 甚至没有包含在内。

回答by marcaldo

I have changed all of them with something like this:

我已经用这样的东西改变了所有这些:

button[data-toggle="dropdown"].btn-default,
button[data-toggle="dropdown"]:hover {
background-color: white !important;
color: #2c3e50 !important;
border: 2px solid #dce4ec;
}