-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckbox.html
107 lines (93 loc) · 2.68 KB
/
checkbox.html
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
/* label */
.check {
padding-left: 1.5em;
display: block;
margin-bottom: .35em;
}
/* check body default */
.input-default {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
}
/* check body custom */
.input-custom {
margin-left: -1.5em;
margin-top: .1em;
position: absolute;
width: .8em;
height: .8em;
box-shadow: 0 0 0 2px #db8e28;
background-color: transparent;
display: flex;
justify-content: center;
align-items: center;
transition: .3s ease-in all;
}
/* check */
.input-custom::after {
content: '';
width: .6em;
height: .2em;
background-color: transparent;
display: block;
}
.input-default:checked + .input-custom::after,
.input-default:checked:disabled + .input-custom::after {
border-bottom: 2px solid #fff;
border-left: 2px solid #fff;
transform: rotate(-45deg);
}
/* checked */
.input-default:checked + .input-custom {
background-color: #db8e28;
}
/* focused */
.input-default:focus + .input-custom {
box-shadow:
0 0 0 2px #db8e28,
0 0 0 3px #ee8906;
}
/* disabled */
.input-default:disabled + .input-custom {
box-shadow: 0 0 0 2px #7f8c8d;
}
/* checked disabled */
.input-default:checked:disabled + .input-custom {
background-color: #7f8c8d;
}
</style>
</head>
<body>
<label class="check">
<input class="input-default" type="checkbox">
<span class="input-custom"></span>
Text
</label>
<label class="check">
<input class="input-default" type="checkbox" checked>
<span class="input-custom"></span>
Text
</label>
<label class="check">
<input class="input-default" type="checkbox" disabled>
<span class="input-custom"></span>
Text
</label>
<label class="check">
<input class="input-default" type="checkbox" checked disabled>
<span class="input-custom"></span>
Text
</label>
</body>
</html>