I'm trying to style a Bootstrap 4 checkbox without a label:
<div class="form-check">
<input class="form-check-input position-static" type="checkbox" id="blankCheckbox" value="option1">
</div>
My trial and error styles:
.form-check {
.form-check-input {
color: #2c2b2c;
font-size: 12px;
line-height: 2.7;
padding-left:15px;
text-transform: uppercase;
background-color: red;
}
.form-check-input::after,
.form-check-input::before {
height: 25px;
width: 25px;
}
.form-check-input::before {
background-color: #fff;
border: 1px solid #2c2b2c;
}
}
}
I'm able to style the label version, but unsuccessful with this version.
UPDATE: As @mebin-joe mentioned, this is a known issue: https://github.com/twbs/bootstrap/issues/26221 I ended up using the custom Bootstrap checkbox element and styled it:
.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;
}