select box change options color

Solutions on MaxInterview for select box change options color by the best coders in the world

showing results for - "select box change options color"
Mario
25 Jul 2020
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>
Alexa
26 Mar 2018
1::selection{
2	background-color: red;
3    color: white;
4}
queries leading to this page
change selection color inputhow to change default color of selectbox in csshtml change color of select optionhow to change color of selection in htmlcss change select option colorhow to change select option color csschange background color of select option using javascriptcss change option colorchange color of select inputselect value color changecss change color of selected option tagchange color select dropdownchange select box colorhtml select color changehtml select option change background colorchange color dropdown salutation selectchange color select csshow to give color to select option in htmlchange color of select optionhow can i change select color with javascriptset color of selectionjavascript change background color select optionmake select option box background color changehow to set background color in select optionchange select option text colorhow to change text color using select valueschange option color csschange color of option in select csswhen seelct a option option color changeform select dropdown background colorselect box color change on selecthow to change the color of the select options in csshow to change the color the selection in csscolor in select optionselect html tag hover background colorchange select form text colourchange select selection color cssselect option background colorwhen seelct a option option color chnagecan i change colors of options in a selectchange color according a selectchange select option colorcss option tag default option colorhow to change the selected text color for select box options in csschange color on selection csscss change color of selected optionhow to change the default hover color of select tag in htmlchaneg color of selection in csschange select color in htmlset option selection color csschange color of selected optionchange color of select dropdownchange background color of option in selectselect option blue color changeset select colorselect box option color and cssselect option change colorchange select box highlight colorcolor to options in select boxhow to change selection color using csshow to change select options hover colrchange selector option colorselect option value color change htmloption change colorhow to change selection color cssselect option box background colorhow to color select optioncss change color of option in selectselected option color change csshow to change css for one select option colorselect selected color change csschange color of option in selectedit the select color in htmlcss option hover colorchange color on selected optionselection color change csschange color for select elementchange text color of selectchange background color of selected option in a select box csschnge option color on selecthtml select hover colorhow to change the select element color in cssselect box change options colorshow to change color in option tagchange the background color of option list in selectchange option color on hover csschange background color of select option on hoverchange select color csscss select chnage item hover colorcss change color of select textchenge color in option valueselect option box inside color changeselect box color csschange text color of option in selecthow to change the select method color in javascriptselect box text color cssselect box color cssselect tag background colorhtml cahnge text color of select optionhow to change option color select element change drop down option hover colorselect change background color selectionselect option color csshow to change the select option colorput color in select optionchange the select value drop down colorchange color to selection csshow to change select option background colorhow to make option change color in htmlcss on select change colorchange select option color javascript change blue color in select stylechange color select drodowncss change color of select optionschange hover color select csschange color on select csshow to changle color select option htmlhow to change colour of blue highlight on select box dropdownchange color option select csscss change background color on selecthtml how to change color of option in selectselect option 3ahover background color change select text color cssoption select colorselect box font colorselect options color csschange color of select option cssshow color in option selectchange background color on hover option htmlselect option change background colorapply background color to selectcss style select background colorchange select dropdown background colorchange color select option csschnage color select option htmlchancge color on select optionchange color of select boxchange hover color on select optionchange color of selected selecthow to change option color in csschange color on selecthow to change select option background color in csshow to set color as select optionhow to sue a combobox to change color in c 23set color of an option in selectselect options color changeselect option color change csshtml select option selected color changeselect dropdown option colorselect option default noneselect option box in color change 27selected option 27css select color changechange color of options in selectchange text color of selected option in a select box csshow to change the select option color in cssi want to change the color of the select field cssselect box option hover color changechanging select optionn colorcolor of default option select htmledit selection color csschange select color html cssselect box change styling csshow to change the background color of select optionchange color of selected option in selectbackground color change by selection boxselect tag color changechange color in select option htmlcss option background color hoverchange color selected option on select htmlselect box option color changeoption hover color change csschange select dropdown color cssinput box select change default colorchange bacground color when hover on selectselect option hover background colorhow to change the color of option in select htmlhow to change color of an select choose optionselect change background color based on selected optionhtml select dropdown item style changehow to set select color cssform select option background colorchange color of select htmlhow to change the colour of selection in csschange option select color csshow to change the color patern of a select elementselect change color of optionhow to change text color of select taghow to set select option colorchange background color of select option in htmlhow to change select dropdown color in csscombobox change colorhow to set color option selectchange color selection csshtml css change selection colorchange select tag bg colorhow to change the hover color of select tagcss change select colourhow to change the color of a select in html csschange background color of select option on hover jqueryhow to change color of the option list in select htmlselect colorselect hover background colorselect color change cssselect item colorchange background color of select dropdownchange html select option hover colorchange background color of selected option on hover csshtml selection color changehow to change the text color of select element csschange select box option border colorhtml5 change select element background color optionhow to change color insice select in htmlchange select option text color csschange option selected color cssdropdown change select color in windowschange select option hover background colorchange color select option on selectdiv background color changed by selection boxchange color of selection box htmlselect option change color csscss change color a selecthow to change the color of selected option in dropdownchange selection color csshow to change the background color of select option in csschange select dropdown stylecss change color on selected optionselect option value color changehtml select hover background color changecss change color of select barselect change colordefault select option hover color changechange color of select box options on clickselect option hover color changehow to change selection color in csschange select dropdown selected colorhow to change color of select optionhow to change background color select box cssselect change blue highlight colorselect option selected value color changehow to use a select box to change the color of a pageselect option background color csschange the color of select tag in htmlchange selection colorhow to change option hover color in csschanging select text coloroptionmenu change colorselect menu change drop down backgound colorhow to edit select colorcchange color of select menucss select box option background colorset selection input colorhow to change the color of select option in csshow to change the select box colorselect text color change in cssstyle select option colordropdown option background color changes on hoverselect option colorcss change color on selectselect box color changing after clicking optioncss select option selected change colorhow to change select option color in csschange blue hover color select htmlhow to change select dropdown colorchange select color htmlhow to make an option in select change colour cssselect option background color change on hoverhow to change the color of a selected optionselect text color changechange select dropdown colorselect dropdown text color change csschange bgcolor of option in select htmlhow to change select color in htmlchange options select box cssdefault select option colorcss change select option highlight colorcss change color of select box highlightchange color in select optionselect box background color changecss change selection colorhow to be different color in select optionchange select option border colorchange color on selected on selectionchange color dropdown salutation select optionhow to change selected option color in csshow to change select tag color in htmlhow to change the color of select option of form in cssdropdown option color changehow to change text color in html using a select boxselect dropdown hover color changehow to change the select color in csscss change select colorselect box selected colordefault option color and when option is selected the color changes custom select html jqueryselect option color change red color in select optioncss select hover colorselect option background color change cssselect dropdown color changehow to use select box to change color of text in paragraphcss change color select optionchange hover color option htmlselect selected color changehow to change selection color css change select option hover background colorhow to change color select optionchange color on select itemchange select colorhow to change the blue color on select option boxcolor change for selected option csshtml change color for selected item in selectdropdown change select colorhow to change the color of the selection in cssdefault selection colorslect option background color changechange select option background colorhow to set background color in select option selectedjavascript change color select optionchange the color of a selected select boxchange color selected optionhow to change select text color by csscss change select options colorchange highlight color of select optionhtml change selection colorchange drop down list background color select htmlhow to change select box option selected background color changehow to change select color in csshow to change the option color on hover in htmlcss change selected option colorhow to use color change optionselect dropdown color change csshtml select option hover colorhow to change color of option in csshow to change 27 27select items 27 27 colorjavascript select option change colorchange color of default select option csschange selection color csselect box only dropdown color changed cssselect box custom hover colorselect box change options colorhtml how to change select colorselet option selected color chnagewhen selcect box select option option color changeselect change color hoverchange color of selectchange option value color in select htmlcss change option hover colorhow to style options in select how to change select option colorhow i change the selected select color in csshtml select option change text colorchange select arow colorselect dropdown option background colorchange selectin colors csscss change select dropdown colorselect field changing colorselect box color changehover on select options and change background colorselect elemen color change in htmlselected option change colorhow to change a selection color in csshow to change color in select option in htmlhtml select element change colourchange select box background colorchange color of option csshow to change background text colour of select dropdown csshow to apply color to select optionchange select highlight colorchange select highlight option to red in select tag in cssselect option set selected option colorhow to change the select colourcss select change text colorhow to change the selection color in cssoption color change csshow i change the selected combo colorcss select box selected option colorchange color of select csscss on select color changechnage select dropdown colorchange select input color cssinput select color changehow to change text color of select optionselect background color csschange select box option background colorhow to change background color of select option in htmlcss select option hover background colorchange select text colorchange color of select box onlyhow to change the color on select in htmlhow to change the background color of option on hoverselect options colorchange select option color csscss change color option selectselect box background colorselect box change options color