0

I want to change the background color of a select box. The color is #F1C26A for the background of the selector. i tried changing the color and the background for this. But don't change. Any idea? Thanks for the help

select.form-control:not([size]):not([multiple]) {
  height: calc(2.25rem + 2px); }

select.form-control:focus::-ms-value {
  color: #F1C26A;
  background-color: #fff; }
<html>
  <head>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    <div class="col-6">
      <select id="Pizzas" name="Pizzas" class="form-control">
        <option value="1" >Option 1</option>
        <option value="2" >Option 2</option>
      </select>
    </div>
  </body>
</html>
41 72 6c
  • 1,600
  • 5
  • 19
  • 30
Fid
  • 1
  • 5
  • 3
    Possible duplicate of [Change select box option background color](https://stackoverflow.com/questions/12836227/change-select-box-option-background-color) – frobinsonj Jun 07 '19 at 10:43

3 Answers3

0

Set the background-color on the select itself, like so select { background-color: #F1C26A; }

ScottieG
  • 318
  • 2
  • 16
0

Just remove -ms-value as it is not supported by most browsers only edge and IE.

select.form-control:not([size]):not([multiple]) {
  height: calc(2.25rem + 2px); }

select.form-control:focus {
  color: #F1C26A;
  background-color: #fff; }
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="col-6">
<select id="Pizzas" name="Pizzas" class="form-control"  >
<option value="1" >Option 1</option>
<option value="2" >Option 2</option>
</select>
</div>
</body>
</html>
ScottieG
  • 318
  • 2
  • 16
0

If you want to change the background option not only select, I recommend using, for example, select2 select2.org.

Background definitely browser, using select2, you can simply change styles. Of course, there are more variations of change select

Jogi
  • 98
  • 2
  • 8