پیشنمایش زنده
کد HTML
<label class="container">
<input type="checkbox" />
<div class="checkbox"></div>
</label>
کد CSS
.container input {
position: absolute;
opacity: 0;
cursor: pointer;
height: 0;
width: 0;
}
.container {
display: block;
position: relative;
cursor: pointer;
font-size: 20px;
user-select: none;
}
.checkbox {
background-color: transparent;
padding: 12px;
border-radius: 5px;
border: grey solid 2px;
box-shadow:
4px 4px 9px black,
inset 2px 2px 5px black,
-1px -1px 5px rgba(68, 67, 67, 0.781),
inset -1px -1px 5px rgba(66, 65, 65, 0.822);
outline: none;
}
.container input:checked ~ .checkbox {
background-color: transparent;
}
.checkbox:after {
content: "";
position: absolute;
display: none;
}
.container input:checked ~ .checkbox:after {
display: block;
}
.container .checkbox:after {
left: 0.52em;
top: 0.28em;
width: 0.25em;
height: 0.5em;
border: solid gold;
border-width: 0 0.15em 0.15em 0;
transform: rotate(45deg);
}