style checkbox in css code example
Example 1: checkbox input in css
//all checkbox
input[type="checkbox"]{
box-shadow: 0 0 0 3px hotpink;
}
// all checked checkbox
input[type="checkbox"]:checked {
box-shadow: 0 0 0 3px hotpink;
}
Example 2: custom checkbox in css
<input type="checkbox">
<label>
<span class="custom-checkbox"></span> my checkbox
</label>
[type="checkbox"] {
opacity: 0;
position: absolute;
}
.custom-checkbox {
min-width: 0.75em;
min-height: 0.75em;
margin-right: 0.75em;
border: 2px solid currentColor;
border-radius: 50%;
display: inline-block;
}
[type="checkbox"]:checked+label .custom-checkbox {
border-color: blue;
background: blue;
box-shadow: inset 0 0 0 2px white;
}