how to change select box option hover background color

Solutions on MaxInterview for how to change select box option hover background color by the best coders in the world

showing results for - "how to change select box option hover background color "
Melia
12 Oct 2017
1/*with a little bit of styling and javascript, you can have a select box with coloured options*/
2/*Note that size attribute = 2 or greater plays an important role here*/
3<style>
4select option:checked {
5  background: #ff9500 -webkit-linear-gradient(bottom, #ff9500 0%, #ff9500 100%);
6}
7select option:hover {
8  background: #ff9500 -webkit-linear-gradient(bottom, #ff9500 0%, #ff9500 100%);
9  color: #fff;
10}
11select option {
12  padding: 8px;
13}
14select {
15  z-index: 1800; 
16  position: absolute; 
17  background: #fff; 
18  height: 33px; 
19  overflow: hidden; 
20  width: 30%;
21  outline: none;
22}
23</style>
24
25<select id="colored_select" size="2" onclick="select_option()">
26  <option value="" selected>Select</option>
27  <option value="1">One</option>
28  <option value="2">Two</option>
29  <option value="3">Three</option>  
30  <option value="4">Four</option>                    
31  <option value="5">Five</option>                    
32  <option value="6">Six</option>                    
33  <option value="7">Seven</option>                    
34  <option value="8">Eight</option>                    
35</select>
36
37<script>
38 function select_option(){
39    var selectBox = document.getElementById("colored_select");
40    $size = selectBox.size;
41    $set_size = 4;
42    if ($size == $set_size) {
43      selectBox.size = 2;
44      selectBox.style.overflow = 'hidden';
45    } else {
46      selectBox.size = $set_size;
47      selectBox.style.height = 'auto';
48      selectBox.style.overflow = 'auto';
49    }
50    var selectedOptionTop = selectBox.options[selectBox.selectedIndex].offsetTop;
51    selectBox.scrollTop = selectedOptionTop;
52  }
53</script>
queries leading to this page
select option color change cssselect option hover color changeselect box change options colorschange background color on hover option htmlcss change option hover colorcss change color option selecthow to change color of an select choose optionhow i change the selected select color in cssmake select option box background color changehtml change color for selected item in selectchange color select option cssselect option box in color change 27selected option 27change select tag bg colorselect tag background colorform select option background colorchange the select value drop down colorselect box font colorhow to change the background color of select optionselect option color csschange blue hover color select htmlselect option hover background colorselect option set selected option colorhow to change select option color in csshtml5 change select element background color optionchange drop down option hover colorhow to change background text colour of select dropdown csschange color of option in select csscss change color on selected optionchange color of selected option in selectchange text color of selectcss select hover colorslect option background color changechange option color csshow to change select options hover colrselect option change color csshow to change selected option color in csshover on select options and change background coloroption hover color change csscss select box selected option colorselect option change colorhow to change option color in csscolor change for selected option csschange blue color in select stylehow to change select dropdown colorhow to change the blue color on select option boxchange select highlight option to red in select tag in cssdefault selection colorchange select box highlight colorselect background hover colorchange color of selected selectchange option selected color cssselect change color hoverchange select box background colorhow to change the color of selected option in dropdownselect selected color changechange select option background colorchange options select box cssselect option background colorchange color selected optionselect box selected colorhow to change select option colordropdown option color changechange select option hover background colorchange color in select option htmlcss select chnage item hover colorcss change option colorhow to set background color in select option selectedhow to style options in select select option box inside color changechange select option text colorchange background color of option in selectchnage color select option htmlchanging select text colorchange color selected option on select htmlselect field changing colorhow to change the selected text color for select box options in cssselect option colorchange the color of select tag in htmlchange color of select dropdownchange color option select csshow to change color select optionchange select dropdown stylehow to change the select box colorchange text color of selected option in a select box csshow to change background color of select option in htmlhow to change color of option in cssselect box custom hover colorselect option background color change on hoveroption select colorcolor of default option select htmlchange select selection color csshow to change the color of select option in cssselet option selected color chnagehtml change color of select optionchange select dropdown selected colorselect options colorselected option change colorhow to change selection colorchange bacground color when hover on selectchange selector option colorcss select option selected change colorchange select option color csschange background color of selected option in a select box csshow to change select box option hover background color