如何在 Bootstrap 4 中设置自定义复选框的样式?我已经尝试了所有方法,但我什至无法更改其背景颜色。
这是我的代码大纲:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input">
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Check this custom checkbox</span>
</label>
我的目标是什么?有人可以告诉我如何更改它的背景吗?
谢谢。
最佳答案
它对我有用
.custom-checkbox .custom-control-input:checked~.custom-control-label::before {
background-color: #caca4c;
}
.custom-control-input:checked~.custom-control-label::before {
color: #fff;
background-color: #caca4c;
}
关于html - 样式 Bootstrap 4 自定义复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44221765/