-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCSS-custom-radio-btn.html
75 lines (63 loc) · 1.58 KB
/
CSS-custom-radio-btn.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 name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
margin-top: 360px;
display: flex;
justify-content: center;
align-items: center;
}
.container {
padding-left: 30px;
margin-bottom: 12px;
position: relative;
}
.container input {
display: none;
}
.checkmark {
width: 25px;
height: 25px;
background: chartreuse;
position: absolute;
top: 0;
left: 0;
border-radius: 50%;
cursor: pointer;
}
.container:hover input~.checkmark {
background-color: cornflowerblue;
}
.container input:checked~.checkmark {
background: crimson;
}
.checkmark::after {
content: " ";
position: absolute;
display: none;
}
.container input:checked~.checkmark:after {
display: block;
}
.container .checkmark::after {
top: 9px;
left: 9px;
width: 8px;
height: 8px;
border-radius: 50%;
background: white;
}
</style>
</head>
<body>
<label class="container" for="radio">
<input type="checkbox" name="radio" id="radio" checked="checked">
<span class="checkmark"></span>
One
</label>
</body>
</html>