how to change selection color

Solutions on MaxInterview for how to change selection color by the best coders in the world

showing results for - "how to change selection color"
Cristóbal
27 Jun 2019
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>
Elias
26 Aug 2016
1::selection{
2	background-color: red;
3    color: white;
4}
queries leading to this page
select box change options colorsselect box only dropdown color changed csschange color dropdown salutation select optionselect box option hover color changehow i change the selected select color in cssselect item colorwhen seelct a option option color chnagechange color dropdown salutation selectselect box font colorchange background color of select option on hoverhow to use a select box to change the color of a pageselect option color cssselect menu change drop down backgound colorchange color select dropdownselect box color changehtml select option selected color changechange drop down option hover colorselect box color change on selectchange option value color in select htmlselect box background colorchange the color of a selected select boxcss change color on selected optionselect change color of optioncss select hover colorchange select input color cssform select dropdown background colorchange background color of select dropdownselect html tag hover background colorwhen selcect box select option option color changeoption change colorselect option change color csshover on select options and change background colorselect dropdown option colorchange select box colorhow to change the select colourhow to set color option selectchange color to selection csschange hover color select csschange blue color in select stylechange select color csshow to change the blue color on select option boxselect colorhow to change select text color by csschange color of selected selectchange selection colorcss change color of selected option tagchange select dropdown color csschange select option text color cssselect option box background colorcss select option hover background colorhow to change colour of blue highlight on select box dropdownhow to change 27 27select items 27 27 colorhtml select element change colourselect box option color and cssselect selected color changehow to change text color using select valueschange color selected optionhow to change selection color in csscss select change text colorhow to give color to select option in htmlapply background color to selectcolor in select optionchange color of option in selectchange select option hover background colorcss change select dropdown colorselect background color optionset option selection color csschange color only 2a select optionselect change colorchange background color of selected option on hover cssselect box option color changechange background color of option in selectchnage color select option htmlhow to set color as select optionchanging select text colorhow to change the select option color in cssset color of an option in selecthow to change text color of select tagi want to change the color of the select field csshow to make option change color in htmlchange the color of select tag in htmlchange color of select dropdownchange color of select htmlchange select dropdown stylehtml select color changehow to change background color of select option in htmlcss change select options colorselect change background color based on selected optioncss change color of select baroption select colorhow to change the color of the part selectcan i change colors of options in a selectchange select selection color csshow to change the color of a selected optionchange select arow coloredit the select color in htmlhow to change select color in csschange select dropdown background colornot change option color on select hoverhow to change text color of select optioncss change select option highlight colorselect dropdown color changedropdown change select colorhow to make an option in select change colour csschange selector option colorcss change color of select box highlightcss select option selected change colorselect option hover color changeselect color change csschange background color on hover option htmlhow to change color of an select choose optionhtml select hover background color changecchange color of select menuhow to change option hover color in csshtml change color for selected item in selectstyle select option colorselect tag background colorchange the select value drop down colorshow color in option selecthow to change the background color of select optiondefault select option hover color changechange color of select box onlychange blue hover color select htmlcss selection default colorselect text color changehow to change the colour of selection in csshow to use select box to change color of text in paragraphhow to change the hover color of select taghow to change select option color csshtml5 change select element background color optioncss change color of select optionshtml css select option hover background colorchange color of option in select csschange color in select optionselect box color csschange color of selected option in selectselect option hover background colorchange select box option border colorchange select text colorselect option value color change htmlchange text color of option in selectchange color of select box options on clickselect option color change html change selection colorhow to change the color of the selection in cssselect option change colorchange background color of select option on hover jquerychange color on select itemhow to be different color in select optionchange text color in select optionchange color for select elementset select colorselect background hover colordropdown option background color changes on hoverchange option selected color csscolor to options in select boxhtml select option change background colorcss change color a selectchange color on selection cssselect change color hoverhow to change css for one select option colorhow to sue a combobox to change color in c 23how to change the color the selection in csshow to change option color select element change color of select optionchange options select box cssselect option background colorselect elemen color change in htmlselect box selected colorchange select option border colorhow to change the option color on hover in htmlhow to color select optionchange hover color option htmlhow to change html symbol 27s colour selecthow to set background color in select option selectedchancge color on select optionchange color select option on selectwhen seelct a option option color changeput color in select optionselect option selected value color changeselect background color cssselect option value color changechange color selection cssselect option background color csshow to change default color of selectbox in csshow to change the color of select option of form in csshow to change color of selection in htmlchange color of default select option csshow to change the selected text color for select box options in csshow to set background color in select optionselect option background color change csschange color option select cssselect dropdown option background colorselect box custom hover colordefault select option colorchange select color htmlhow to change the color of select option in csschange color of options in selectchange option color on hover cssselect options color changehow to change the color of a select in html csschange select dropdown selected colorchange color 2a select option select options colorhow to change select color in htmlhow to change text color in html using a select boxselect dropdown hover color changeoptionmenu change colorhtml select dropdown item style changehtml cahnge text color of select optionchnge option color on selectchange bacground color when hover on selectselect box color csshow i change the selected combo colorchange background color of select option using javascriptinput select color changehow to change select option background colorchange color of select option csshow to change the selection color in csshow to change the background color of select option in csscombobox change colorcss change selection colordropdown change select color in windowschange background color of selected option in a select box csshow to change background color select box csschange color of selected optionselect option change background colorchange select highlight colorselect dropdown color change csschange color select drodownmake select option box background color changehow to change the color of the select options in csscss on select change colorselect hover background colorchange color select option csshow to change the color patern of a select elementform select option background colorhow to change a selection color in csschange color on selecthow to change color of select optionchaneg color of selection in csshow to change the color on select in htmlselect option set selected option colorchange selection color csshow to change select option color in cssselect options color csshow to change background text colour of select dropdown cssselect selected color change csshow to edit select colorhow to change the select color in csschange color according a selectcss option hover coloredit selection color cssslect option background color changecss on select color changechange select option color javascript change option color csshow to change select options hover colrchange select box option background colorhow to change selection color using cssselect change blue highlight colorhow to change selected option color in csscss option background color hoveroption hover color change csscss select box selected option colorhow to change the color of option in select htmlcss change color of option in selecthtml css change selection colorhow to change select dropdown colorselect option 3ahover background color default selection colorcss change color of select textselect box background color changeselect value color changecss option tag default option colorhow to change the color of selected option in dropdownchange select option background colorhow to change select option colorhow can i change select color with javascriptselected option color change csscss change select option colorchange color in select option htmlchange html select option hover colorcss select chnage item hover colorchange option select color csshow to style options in select select box change styling csshtml how to change select colorhtml how to change color of option in selectchange highlight color of select optionselect field changing colorselect option colorchange selection color cshow to change color select optioncss change select colourhow to set select colorhow to change color of option in cssselect option background color change on hovercolor of default option select htmlselet option selected color chnagehow to change color in select option in htmlhtml change color of select optionhow to use color change optionchange select option colorchange color of select boxchange select form text colourselect box text color cssselect text color change in cssjavascript change color select optionoption color change cssdefault option color and when option is selected the color changes custom select html jquerycss change select colorselect option color change cssselect box color changing after clicking optionchange color on selected optionchange drop down list background color select htmlcss change option hover colorjavascript select option change colorhow to change selection color csscss change color option selecthow to change select box option selected background color changehtml selection color changeselection color change cssbackground color change by selection boxhow to change color of the option list in select htmlchange color of select cssselect option box in color change 27selected option 27change select tag bg colorhow to change color insice select in htmlset color of selectionhtml select hover colorchange color on selected on selectioncss change background color on selecthow to apply color to select optionselect dropdown text color change cssselect tag color changechange color of select inputchange text color of selectselect change background color selectionhow to change the background color of option on hoverchange color select csshow to change select option background color in csscss change color of selected optionhtml select option change text colorjavascript change background color select optionchange color of selecthow to change option color in csscolor change for selected option csschange select highlight option to red in select tag in cssselect box change options colorchange selectin colors csschange select box highlight colorhow to change the default hover color of select tag in htmldiv background color changed by selection boxhtml select option hover colorselect option blue color changechange color of dropdowninput box select change default colorhow to set select color csschange bgcolor of option in select htmlchanging select optionn colorhow to changle color select option htmlcss change color on selectchange select box background colorchange select text color cssdropdown option color changecss change option colorchange color of selection box htmlselect option box inside color changecss change selected option colorcss change color select optionhow to change select tag color in htmlchange select option text colorchange select colorcss select box option background colorchange select dropdown colorchange the background color of option list in selectchange select color html csschange color selected option on select htmlhow to change selection color how to change the select element color in csschenge color in option valuecss style select background colorhow to change select dropdown color in csshow to change the select box colorchange text color of selected option in a select box csschnage select dropdown colorhow to change the select method color in javascriptselect option default nonechange color on select csschange selection color inputchange hover color on select optionchange select color in htmlchange color of option cssselected option change colorhow to change color in option taghow to change the text color of select element csscss change select option hover background colorhow to change the select option colorhow to set select option colorchange select option color csschange css according to select option from dropdownset selection input colorcss select color changechange background color of select option in htmlred color in select optionhow to change selection color