Bootstrap 5 - 选项选择更改背景颜色和字体颜色

时间:2021-04-23 09:45:01

标签: css twitter-bootstrap

我正在尝试更改表单选择元素内选项的背景颜色和字体颜色。我用过 Boostrap 5。

我想当我点击时显示带有自定义背景颜色和字体颜色的选项:

表单选择选项 enter image description here

html 代码:

select option {
  background-color: yellow !important;
  color: red !important;
}
<div>
  <select class="form-select" aria-label="Default select example">
    <option selected id="Subject">Subject</option>
    <option value="1">One</option>
    <option value="2">Two</option>
    <option value="3">Three</option>
  </select>
</div>

Here 官方文档。

也许有人可以帮助我。

谢谢。

0 个答案:

没有答案
相关问题