javascript - change browser's blue default color when selecting an option element in a select element -
i know how change color of background of options element, , hover.
what i'm trying change default browser's color (blue in chrome) when click on option element, , while "select" still on focus.
i made pen:
http://codepen.io/dieggger/pen/qbrzxp
-------------------------------html --------------------------------
<select size="3" name='options' multiple> <option value='option-1' class="options">option 1</option> <option value='option-2' class="options">option 2</option> <option value='option-3' class="options">option 3</option> </select> <p> lorem ipsum dolor sit amet, consectetur adipisicing elit. iure suscipit eos hic voluptatibus ratione impedit ullam sequi, delectus rem. corporis nemo </p>
-------------------------------css---------------------------------------
select{ border-radius:.5em; width:200px; height:100px; } ::selection { background: #ffb7b7; } ::-moz-selection { background: #ffb7b7; } *:focus { outline: #ffb7b7 solid 5px; }
i'd make blue default color #ffb7b7 outline , text selection.
thanks in advance!
ok, played codepen , found solution :
option:checked { box-shadow: 0 0 10px 100px #ffb7b7 inset; }
i added code in css. seems box-shadow replaces browser color works :) (tested on firefox, chrome 44)
Comments
Post a Comment