【发布时间】:2015-12-31 12:43:12
【问题描述】:
目前,当用户从任一框中单击选项时,选项背景会变为蓝色一秒钟,然后该选项会移动到另一个选择框。
我想将颜色从蓝色更改为其他颜色。
这究竟是什么状态?应用于option:active、option:hover、option:focus 的 CSS 无法选择此状态并更改颜色。
我认为这可能有效,但它也失败了。
select:-internal-list-box option:checked {
color: #333 !important;
background-color: #FFC894 !important;
}
也没有:
select:-internal-list-box option:selected {
color: #333 !important;
background-color: #FFC894 !important;
}
select:-internal-list-box:focus option:checked {
color: #333 !important;
background-color: #FFC894 !important;
}
select:-internal-list-box:focus option:selected {
color: #333 !important;
background-color: #FFC894 !important;
}
select:-internal-list-box:focus option::selection {
color: #333 !important;
background-color: #FFC894 !important;
}
.bootstrap-duallistbox-container:focus select option::selection {
background: #ffb7b7 !important;
}
如何更改单击选项时显示的背景颜色?
这是一个 jsFiddle 显示问题
【问题讨论】:
-
@CBroe,不-它很容易摆脱带有伪选择器的默认浏览器着色-这是我的尝试-> jsfiddle.net/b4x3ar6q,但是什么关于单击/移动项目时的小延迟?这是一个真正的好问题:)
-
@davidkonrad 没错!原来是
background属性,而不是background-color
标签: html css twitter-bootstrap drop-down-menu