@@ -14,30 +14,80 @@ <h1>Border Playground</h1>
14
14
< section class ="selection ">
15
15
<!-- 1 -->
16
16
< div class ="borderColor ">
17
- < p > Border Color</ p >
18
- < div class ="colors ">
19
- < input type ="radio " name ="red " id ="red " />
20
- < input type ="radio " name ="orange " id ="orange " />
21
- < input type ="radio " name ="yellow " id ="yellow " />
22
- < input type ="radio " name ="cyan " id ="cyan " />
23
- < input type ="radio " name ="blue " id ="blue " />
24
- < input type ="radio " name ="purple " id ="purple " />
25
- < input type ="radio " name ="pink " id ="pink " />
26
- < input type ="radio " name ="gray " id ="gray " />
27
- </ div >
17
+ < p > < strong > Border Color</ strong > </ p >
18
+ < fieldset >
19
+ < div class ="colors ">
20
+ < div class ="radio ">
21
+ < label for ="red "> red</ label >
22
+ < input type ="radio " name ="color " id ="red " />
23
+ < div class ="imaginary-circle "> </ div >
24
+ < div class ="outer-ring "> </ div >
25
+ </ div >
26
+ < div class ="radio ">
27
+ < label for ="green "> green</ label >
28
+ < input type ="radio " name ="color " id ="green " />
29
+ < div class ="imaginary-circle "> </ div >
30
+ < div class ="outer-ring "> </ div >
31
+ </ div >
32
+ < div class ="radio ">
33
+ < label for ="blue "> blue</ label >
34
+ < input type ="radio " name ="color " id ="blue " />
35
+ < div class ="imaginary-circle "> </ div >
36
+ < div class ="outer-ring "> </ div >
37
+ </ div >
38
+ < div class ="radio ">
39
+ < label for ="orange "> orange</ label >
40
+ < input type ="radio " name ="color " id ="orange " />
41
+ < div class ="imaginary-circle "> </ div >
42
+ < div class ="outer-ring "> </ div >
43
+ </ div >
44
+ < div class ="radio ">
45
+ < label for ="hotpink "> hotpink</ label >
46
+ < input type ="radio " name ="color " id ="hotpink " />
47
+ < div class ="imaginary-circle "> </ div >
48
+ < div class ="outer-ring "> </ div >
49
+ </ div >
50
+ < div class ="radio ">
51
+ < label for ="purple "> purple</ label >
52
+ < input type ="radio " name ="color " id ="purple " />
53
+ < div class ="imaginary-circle "> </ div >
54
+ < div class ="outer-ring "> </ div >
55
+ </ div >
56
+ < div class ="radio ">
57
+ < label for ="brown "> brown</ label >
58
+ < input type ="radio " name ="color " id ="brown " />
59
+ < div class ="imaginary-circle "> </ div >
60
+ < div class ="outer-ring "> </ div >
61
+ </ div >
62
+ </ div >
63
+ </ fieldset >
28
64
</ div >
29
65
<!-- 2 -->
30
66
< div class ="borderWidth ">
31
- < p > Border Color</ p >
32
- < div >
33
- < input type ="range " id ="volume " name ="volume " min ="1 " max ="25 " />
67
+ < p > < strong > Border Color</ strong > </ p >
68
+ < div class ="slider ">
69
+ < input
70
+ type ="range "
71
+ id ="volume "
72
+ name ="volume "
73
+ min ="1 "
74
+ max ="25 "
75
+ value ="1 "
76
+ />
34
77
</ div >
35
78
</ div >
36
79
<!-- 3 -->
37
80
< div class ="borderRadius ">
38
- < p > Border Radius</ p >
39
- < div >
40
- < input type ="range " id ="volume " name ="volume " min ="0 " max ="50 " />
81
+ < p > < strong > Border Radius</ strong > </ p >
82
+ < div class ="slider ">
83
+ < input
84
+ type ="range "
85
+ id ="volume "
86
+ name ="volume "
87
+ min ="0 "
88
+ max ="50 "
89
+ value ="1 "
90
+ />
41
91
</ div >
42
92
</ div >
43
93
</ section >
@@ -53,5 +103,33 @@ <h1>Border Playground</h1>
53
103
< div class ="box nine "> Mixed (Dashed Solid)</ div >
54
104
</ section >
55
105
</ main >
106
+
107
+ < script >
108
+ const colorRadioButtons = document . querySelectorAll (
109
+ ".radio input[type='radio']"
110
+ ) ; // Select all color radio buttons
111
+
112
+ colorRadioButtons . forEach ( ( radioButton ) => {
113
+ const imaginaryCircle = radioButton . nextElementSibling ; // Get imaginary circle
114
+ const outerRing = imaginaryCircle . nextElementSibling ; // Get outer ring circle
115
+
116
+ radioButton . addEventListener ( "change" , ( ) => {
117
+ if ( radioButton . checked ) {
118
+ colorRadioButtons . forEach ( ( radioButton ) => {
119
+ // Reset all outline
120
+ const imaginaryCircle = radioButton . nextElementSibling ; // Get imaginary circle
121
+ const outerRing = imaginaryCircle . nextElementSibling ; // Get outer ring
122
+ imaginaryCircle . style = "" ;
123
+ outerRing . style = "" ;
124
+ } ) ;
125
+
126
+ const selectedColor = radioButton . id ; // Get selected color from id
127
+ imaginaryCircle . style . outline = "2px solid white" ; // Imaginary circle white outline
128
+ outerRing . style . outline = `2px solid ${ selectedColor } ` ; // Outer circle colored outline
129
+ outerRing . style . outlineOffset = "2px" ; // Offset colored outline
130
+ }
131
+ } ) ;
132
+ } ) ;
133
+ </ script >
56
134
</ body >
57
135
</ html >
0 commit comments