MaterializeCSS Select 背景色

MaterializeCSS Select Background Color

我尝试了 MaterializeCSS 的背景色 select。我试图使用这个问题,但它没有像常规 HTML(没有 Materialize)那样工作 Change select box option background color

我该怎么做?

这与 Materialise 的选择器有关。以下代码对我有用:

<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<div class="input-field col s12">
    <select class="select1">
        <option value="1" selected>Option 1</option>
        <option value="2">Option 2</option>
        <option value="3">Option 3</option>
    </select>
    <label>Materialize Select</label>
</div>
<style>
  input.select-dropdown {
      background: #1A1B1C !important;
      color: #26a69a;
  }
  ul.dropdown-content.select-dropdown li span {
      background: #1A1B1C; 
  }
</style>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        var elems = document.querySelectorAll('select');
        var instances = M.FormSelect.init(elems);
    });
</script>