-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtwo-buttons.html
125 lines (106 loc) · 2.84 KB
/
two-buttons.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Two buttons</title>
<style>
@charset "UTF-8";
:root {
--toggleBgc: #ccd0d4;
}
body {
background-color: #333;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.container {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.toggle {
display: inline-block;
margin: 34px;
width: 140px;
height: 140px;
position: relative;
background-color: var(--toggleBgc);
border-radius: 8px;
box-shadow: inset 0 0 35px 5px rgba(0, 0, 0, 0.3), inset 0 2px 1px 1px rgba(255, 255, 255, 0.9), inset 0 -2px 1px 0px rgba(0, 0, 0, 0.3), 0 2px 5px 5px rgba(0, 0, 0, 0.3);
}
.toggle::before {
content: "";
position: absolute;
width: 100px;
height: 100px;
border-radius: 50px;
background-color: #fff;
left: 50%;
top: 50%;
margin-left: -50px;
margin-top: -50px;
box-shadow: 0 0 36px 8px rgba(255, 255, 255, 0.6);
}
.toggle .button {
display: block;
width: 96px;
height: 96px;
background-color: #ccd0d4;
position: absolute;
border-radius: 96px;
margin-left: -48px;
margin-top: -48px;
left: 50%;
top: 50%;
box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.5), inset 0 -3px 5px 2px rgba(0, 0, 0, 0.2), inset 0 3px 5px 1px rgba(255, 255, 255, 0.7), inset 0 0 5px 1px rgba(255, 255, 255, 0.8), inset 0 20px 30px 0 rgba(255, 255, 255, 0.2);
}
.toggle .label {
display: block;
position: absolute;
color: rgba(0, 0, 0, 0.3);
width: 100%;
height: 100%;
font-size: 46px;
text-align: center;
line-height: 136px;
font-weight: 700;
top: 0;
left: 0;
opacity: 0.9;
text-shadow: 1px 1px 3px #ccd0d4, 0px 0px 0px rgba(0, 0, 0, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.5);
}
.toggle input {
opacity: 0;
width: 100%;
height: 100%;
position: absolute;
z-index: 1;
left: 0;
top: 0;
margin: 0;
}
.toggle input:checked~.button {
box-shadow: 0 15px 25px -4px rgba(0, 0, 0, 0.4), inset 0 -3px 6px 2px rgba(255, 255, 255, 0.9), inset 0 8px 25px 0px rgba(0, 0, 0, 0.2);
}
</style>
</head>
<body>
<div class="container">
<div class="toggle">
<input type="radio" name="btn" checked>
<span class="button"></span>
<span class="label">+</span>
</div>
<div class="toggle">
<input type="radio" name="btn">
<span class="button"></span>
<span class="label">–</span>
</div>
</div>
</body>
</html>