This repository has been 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
/
Task7.html
129 lines (117 loc) · 3.14 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!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>Document</title>
<style>
/* Navbar container */
.navbar {
overflow: hidden;
background-color: rgb(255, 10, 255);
font-family: Arial;
border-radius: 10px;
}
/* Links inside the navbar */
.navbar a {
float: left;
font-size: 16px;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* The dropdown container */
.dropdown {
float: left;
overflow: hidden;
}
/* Dropdown button */
.dropdown .dropbtn {
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit; /* Important for vertical align on mobile phones */
margin: 0; /* Important for vertical align on mobile phones */
}
/* Add a red background color to navbar links on hover */
.navbar a:hover, .dropdown:hover .dropbtn {
background-color: rgba(229, 255, 0, 0.932);
color: Brown;
border-radius: 12px;
}
/* Dropdown content (hidden by default) */
.dropdown-content {
display: none;
border-radius: 15px;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
#mydropdown{
display: none;
}
/* Links inside the dropdown */
.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
/* Add a grey background color to dropdown links on hover */
.dropdown-content a:hover {
background-color: #ddd;
}
/* Show the dropdown menu on hover */
.dropdown:hover:first-child .dropdown-content {
display: block;
}
</style>
</head>
<body>
<div class="navbar">
<div class="dropdown">
<button onmouseover=myClose() class="dropbtn">Hover</button>
<div class="dropdown-content">
<a href="https://github.com">Profile</a>
<a href="https://github.com/CC-BHU/">Coding Club</a>
<a href="https://github.com/CC-BHU/web-development">Repository</a>
</div>
</div>
<div class="dropdown">
<button onclick=myFunction() class="dropbtn">Click</button>
<div id="myDropdown" class="dropdown-content">
<a href="https://github.com">Profile</a>
<a href="https://github.com/CC-BHU/">Coding Club</a>
<a href="https://github.com/CC-BHU/web-development">Repository</a>
</div>
</div>
<Script>
function myClose() {
myDropdown.style.display = "none";
}
function myFunction() {
console.log("Called");
var x = document.getElementById("myDropdown");
if (x.style.display == "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
event.stopPropagation();
}
// Close the dropdown if the user clicks outside of it
document.onclick = function() {
myDropdown.style.display = "none";
}
</Script>
</body>
</html>