This repository was archived by the owner on Jul 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathtask7.html
103 lines (100 loc) · 2.97 KB
/
task7.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!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>task7</title>
<style>
.navbar{
background-color: lightcoral;
border-radius: 15px;
overflow: hidden;
}
.dropbutton {
display: none;
border: none;
border-radius: 15px;
float: left;
padding: 15px;
color: white;
background-color: inherit;
text-decoration: none;
font-size: 17px;
display: block;
}
.dropbutton:hover{
background-color:lightskyblue;
border-radius: 10px;
cursor: pointer;
}
.drophover, .dropclick{
float: left;
overflow: hidden;
}
.drophover-content , .dropclick-content {
margin-top: 50px;
display: none;
position: absolute;
background-color: #f9f9f8;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.drophover:hover .drophover-content {
display: block;
}
.drophover-content a , .dropclick-content a{
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.drophover-content a:hover ,.dropclick-content a:hover {
background-color: #ddd;
}
.show {display: block;}
</style>
</head>
<body>
<div class="navbar">
<div class="drophover">
<button class="dropbutton">Hover</button>
<div class="drophover-content">
<a href="">Profile</a>
<a href="">Coding Club</a>
<a href="">Repository</a>
</div>
</div>
<div class="dropclick">
<button onclick="myFunction()" class="dropbutton">
Click
</button>
<div id="myDropdown" class="dropclick-content">
<a href="">Profile</a>
<a href="">Coding Club</a>
<a href="">Repository</a>
</div>
</div>
</div>
<script>
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
window.onclick = function(event) {
if (!event.target.matches('.dropbutton')) {
var dropdowns = document.getElementsByClassName("dropclick-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
</body>
</html>