-
Notifications
You must be signed in to change notification settings - Fork 0
/
radio2.html
114 lines (105 loc) · 2.93 KB
/
radio2.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
<!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>Custom Radio Button</title>
<style>
* {
padding: 0;
margin: 0;
}
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: #001f4a;
min-height: 100vh;
}
label {
width: 200px;
height: 70px;
margin: 12px;
position: relative;
cursor: pointer;
}
label input {
appearance: none;
-webkit-appearance: none;
}
label span {
width: 100%;
height: 100%;
display: block;
position: relative;
background: #000;
border-radius: 10px;
}
label span::before {
content: 'Inactive';
width: calc(100% - 6px);
height: calc(100% - 6px);
position: absolute;
top: 3px;
left: 3px;
background: linear-gradient(to bottom, #081d22, #073130);
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
font-size: 1.4em;
font-weight: 600;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5),
inset 2px 2px 2px rgba(255, 255, 255, 0.3);
}
label input:checked ~ span::before {
color: #fff;
content: 'Active';
text-shadow: 0 0 30px #0f0;
background: linear-gradient(to top, #081d22, #073130);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5),
inset 1px 1px 1px rgba(0, 0, 0, 0.3),
inset -1px -1px 1px rgba(255, 255, 255, 0.3);
}
label span::after {
position: absolute;
content: '';
transition: .2s;
background: red;
width: 12px;
height: 12px;
border-radius: 50%;
top: 50%;
transform: translateY(-50%);
right: 20px;
box-shadow: 0 0 5px red,
0 0 10px red,
0 0 15px red,
0 0 20px red,
0 0 25px red,
0 0 30px red;
}
label input:checked ~ span::after {
background: #0f0;
box-shadow: 0 0 5px #0f0,
0 0 10px #0f0,
0 0 15px #0f0,
0 0 20px #0f0,
0 0 25px #0f0,
0 0 30px #0f0;
}
</style>
</head>
<body>
<label>
<input type="radio" name="btn" checked>
<span></span>
</label>
<label>
<input type="radio" name="btn">
<span></span>
</label>
</body>
</html>