체크박스 디자인-2 (checkbox Design-2 with CSS)

기본 체크박스로 활용할 수 있다.

✔️ HTML

1
2
3
4
5
6
<div class="cbxBox">
<label class="box">
<input type="checkbox" checked="">
<span></span>
</label>
</div>

✔️ CSS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
.cbxBox {
position: relative;
left: 50%;
}
.box {
display: flex;
align-items: center;
}
.box input[type="checkbox"] {
position: relative;
height: 35px;
width: 35px;
appearance: none;
background-color: #FFF;
border-radius: 10px;
cursor: pointer;
overflow: hidden;
}
.box input[type="checkbox"]::after {
content: '';
display: block;
height: 15px;
width: 8px;
border-bottom: 4px solid #e1f5fe;
border-right: 4px solid #e1f5fe;
opacity: 0;
transform: rotate(45deg) translate(-50%, -50%);
position: absolute;
top: 45%;
left: 25%;
transition: all .25s cubic-bezier(0.075, 0.82, 0.165, 1);
}
.box input[type="checkbox"]::before {
position: absolute;
display: block;
content: '';
height: 0;
width: 0;
background-color: #01579b;
border-radius: 50%;
opacity: .5;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
transition: all .5s cubic-bezier(0.075, 0.82, 0.165, 1);
}
.box input[type="checkbox"]:checked::before {
height: 120%;
width: 120%;
opacity: 100%;
}
.box input[type="checkbox"]:checked::after {
opacity: 100%;
}

✔️ GitHub
링크