-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdropbutton.html
68 lines (56 loc) · 1.2 KB
/
dropbutton.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
<!DOCTYPE html>
<html>
<head>
<title>下拉菜单实例|菜鸟教程(runoob.com)</title>
<meta charset="utf-8">
<style>
.dropdownComponent {
position: relative;
display: inline-block;
}
.dropdownComponent:hover .dropContent {
display: block;
}
.dropdownComponent:hover .dropBtn {
background-color: #3e8e41;
}
.dropBtn {
background-color: #4CAF50;
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
}
.dropContent {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.dropContent a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropContent a:hover {
background-color: #f1f1f1
}
</style>
</head>
<body>
<h2>下拉菜单</h2>
<p>鼠标移动到按钮上打开下拉菜单。</p>
<div class="dropdownComponent">
<button class="dropBtn">下拉菜单</button>
<div class="dropContent">
<a href="http://www.runoob.com">菜鸟教程 1</a>
<a href="http://www.runoob.com">菜鸟教程 2</a>
<a href="http://www.runoob.com">菜鸟教程 3</a>
</div>
</div>
<h2>测试文字</h2>
</body>
</html>