I'm attempting to customize the appearance of a Bootstrap 4 checkbox without including a label:
<div class="form-check">
<input class="form-check-input position-static" type="checkbox" id="blankCheckbox" value="option1">
</div>
Here are the styles I have experimented with:
.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;
}
}
}
While successful in styling the labeled version, I have encountered challenges with this particular approach.
UPDATE: Following @mebin-joe's advice, it appears that this issue is well-documented: https://github.com/twbs/bootstrap/issues/26221 I have opted to utilize the custom Bootstrap checkbox element and apply the following styling:
.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;
}