【发布时间】:2020-10-19 21:27:08
【问题描述】:
我不知道如何更改此 Bootstrap 4 切换开关的“已检查”背景颜色。它使用一个额外的库来切换深色和浅色模式 - Here on github - 但它有效。我要做的就是更改活动复选框的背景颜色,默认为蓝色。它在 Bootstrap CSS 中默认为蓝色吗?这个答案Change Bootstrap 4 checkbox background color 对我不起作用;它会更改未选中的颜色,但我无法从中获取如何更改选中的颜色。
我的代码在这里:
.custom-control-input {
background-color: red;
}
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="darkSwitch" />
<label class="custom-control-label" for="darkSwitch">Dark Mode</label>
</div>
【问题讨论】:
标签: css checkbox bootstrap-4