-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathradio.html
75 lines (75 loc) · 2.27 KB
/
radio.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
<!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;justify-content: center;align-items: center;min-height: 100vh;background-color: #111;flex-direction: column;}
input[type="radio"] {
position: relative;
width: 120px;
height: 40px;
margin: 10px;
outline: none;
background: #222;
-webkit-appearance: none;
cursor: pointer;
border-radius: 40px;
box-shadow: -5px -5px 20px rgba(255, 255, 255, 0.1),
2px 2px 10px rgba(0, 0, 0, 1),
inset -2px -2px 5px rgba(255, 255, 255, 0.1),
inset 2px 2px 5px rgba(0, 0, 0, 1),
0 0 0 2px #1f1f1f;
transition: 0.5s;
}
input[type="radio"]:checked {
background: #ffae11;
}
input[type="radio"]::before {
position: absolute;
content: '';
width: 80px;
top: 0;
left: 0;
height: 40px;
background: linear-gradient(to top, #000, #555);
border-radius: 40px;
box-shadow: 0 0 0 1px #232323;
transform: scale(0.98, 0.96);
transition: 0.5s;
}
input[type="radio"]:checked:before {
left: 40px;
}
input[type="radio"]::after {
position: absolute;
content: '';
width: 5px;
top: 50%;
height: 5px;
background: #111;
border-radius: 50%;
right: 55px;
transform: translateY(-50%);
box-shadow: none;
transition: 0.5s;
}
input[type="radio"]:checked:after {
right: 15px;
background: #ffae11;
box-shadow: 0 0 5px #ffae11,0 0 15px #ffae11;
}
</style>
</head>
<body>
<label>
<input type="radio" name="btn">
</label>
<label>
<input type="radio" name="btn">
</label>
</body>
</html>