-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRadio-Button-Style.html
51 lines (45 loc) · 1.3 KB
/
Radio-Button-Style.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
<!DOCTYPE html>
<html>
<head>
<style>
/* Hide the default radio button appearance */
input[type="radio"] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: 2px solid black;
width: 20px;
height: 20px;
border-radius: 50%;
position: relative;
background-color: white;
}
/* Unchecked state: inner dot is white */
input[type="radio"]::after {
content: '';
width: 12px;
height: 12px;
background-color: white; /* White inner dot */
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
/* Checked state: inner dot is black and border color changes */
input[type="radio"]:checked {
border-color:black;
}
input[type="radio"]:checked::after {
background-color: #8BD3C8 ; /* Black inner dot when checked */
}
</style>
</head>
<body>
<center>
<h3>Custom Radio Button with Dynamic Styles</h3>
<input type="radio" name="radio1" value="GFG">
<label for="specifyColor">GFG</label>
</center>
</body>
</html>