-
Notifications
You must be signed in to change notification settings - Fork 0
/
10_selection_box.html
53 lines (45 loc) · 1.42 KB
/
10_selection_box.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Country Capital</title>
<style>
/* Custom CSS for the capital */
.capital {
display: none;
color: blue;
font-weight: bold;
font-size: 16px;
}
/* Show capital when the corresponding checkbox is checked */
#USA:checked ~ #capital-USA,
#UK:checked ~ #capital-UK,
#France:checked ~ #capital-France,
#Germany:checked ~ #capital-Germany,
#Japan:checked ~ #capital-Japan {
display: inline;
}
</style>
</head>
<body>
<h2>Select a Country:</h2>
<input type="radio" id="USA" name="country" value="USA">
<label for="USA">United States</label><br>
<input type="radio" id="UK" name="country" value="UK">
<label for="UK">United Kingdom</label><br>
<input type="radio" id="France" name="country" value="France">
<label for="France">France</label><br>
<input type="radio" id="Germany" name="country" value="Germany">
<label for="Germany">Germany</label><br>
<input type="radio" id="Japan" name="country" value="Japan">
<label for="Japan">Japan</label><br>
<p>Capital:
<span id="capital-USA" class="capital">Washington, D.C.</span>
<span id="capital-UK" class="capital">London</span>
<span id="capital-France" class="capital">Paris</span>
<span id="capital-Germany" class="capital">Berlin</span>
<span id="capital-Japan" class="capital">Tokyo</span>
</p>
</body>
</html>