Just changing CSS won't work
Trying to set the background on input="checkbox" won't work when just given "background:some_color"
because it has default values which will always override.
So we should use a label tag and a div tag to wrap the input tag, wherein input checkbox itself is hidden.
HTML
<label class="contain">
<input type="checkbox"/>
<div class="fake-input"/>
</label>
CSS
.contain *, .contain *::before, .contain *::after {
box-sizing: content-box !important;
}
.contain input {
position: absolute;
z-index: -1;
opacity: 0;
}
.contain {
display: table;
position: relative;
padding-left: 1.8rem;
cursor: pointer;
margin-bottom: .5rem;
}
.contain input[type="checkbox"] ~ .fake-input {
position: absolute;
top: 0;
left: 0;
height: 1.25rem;
width: 1.25rem;
background: rgba(0, 245, 248, 1);
transition: background 250ms;
border: 1px solid rgba(184, 194, 204, 1);
border-radius: 0.125rem;
}
.contain input[type="checkbox"] ~ .fake-input::after {
content: '';
position: absolute;
display: none;
left: .45rem;
top: .18rem;
width: .25rem;
height: .6rem;
border: solid rgba(255, 255, 255, 1);
border-width: 0 2px 2px 0;
transition: background 250ms;
transform: rotate(45deg);
}
.contain input:checked ~ .fake-input::after {
display: block;
}
.contain:hover input ~ .fake-input,
.contain input:focus ~ .fake-input {
background: rgb(10, 38, 43);
}
.contain input:focus ~ .fake-input {
box-shadow: 0 0 0 2px rgba(52,144,220,0.5);
}
.b-contain input:checked ~ .b-input {
background: rgba(0, 130, 243, 1);
border-color: rgba(0, 130, 243, 1);
}
If still are unsure about this, visit Bun.js. My answer is referred from there.