checkbox
HTML
<html>
<head>
</head>
<body>
<div class="h2">
Кастомный чекбокс
</div>
<div class="Elements__item">
<div class="Elements__checkbox">
<label class="mark">One
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
<label class="mark">Two
<input type="checkbox">
<span class="checkmark"></span>
</label>
<label class="mark">Three
<input type="checkbox">
<span class="checkmark"></span>
</label>
<label class="mark">Four
<input type="checkbox">
<span class="checkmark"></span>
</label>
</div>
</div>
</body>
</html>
CSS
.mark {
display: block;
position: relative;
padding-left: 35px;
margin-bottom: 12px;
cursor: pointer;
font-size: 22px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.mark input {
position: absolute;
opacity: 0;
cursor: pointer;
height: 0;
width: 0;
}
.checkmark {
position: absolute;
top: 0;
left: 0;
height: 25px;
width: 25px;
background-color: #eee;
}
.mark:hover input ~ .checkmark {
background-color: #ccc;
}
.mark input:checked ~ .checkmark {
background-color: #330080;
}
.checkmark:after {
content: "";
position: absolute;
display: none;
}
.mark input:checked ~ .checkmark:after {
display: block;
border-width: 0 3px 3px 0;
}
.mark .checkmark:after {
left: 10px;
top: 7px;
width: 5px;
height: 10px;
border: solid white;
border-width:0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
transition: border-width 2s linear;
}