Im using bootstrap-duallistbox
Currently, when users click an option from either box, the option background turns blue for a second then the option is moved to the other select box.
I would like to change the color from blue to something else.
What state is this exactly? CSS applied to option:active
, option:hover
, option:focus
do not work to select this state and change the color.
I thought this might work, but it also failed.
select:-internal-list-box option:checked {
color: #333 !important;
background-color: #FFC894 !important;
}
Nor did:
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;
}
How can I change the background color displayed when an option is clicked?
What I have tried in inspect element form bootstrap-duallistbox
for options hover
Turns out that to do this, you have to set the
background
property of theoption
not thebackground-color
property like so:Tested working in the following browsers:
Windows
Mac
Ubuntu (thanks @davidkonrad)
Safari does see the property, it shows active in the inspector, but it somehow ignores it anyway.
My total guess at why this works
Using CSS multiple backgrounds states:
It seems to me that, the user agent blue background is still there, but the colored background added by
background: linear-gradient(#FFC894,#FFC894);
is layered on top of it.