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
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
body{
margin : 10px;
padding: 10px;
text-align: center;
}
.dropdown{
position: relative;
display: inline-block;
}
.button{
padding: 10px 40px;
font-size:20px;
background-color: brown;
color: wheat;
}
#drop-content{
position: absolute;
z-index: 1;
}
#drop-content a{
display:block;
font-size: 20px;
background-color: #dfdfdf;
color: black;
text-decoration: none;
padding: 10px 36px;
margin: 2px 0px 0px 0px;
}
</style>
<body>
<div class="dropdown">
<button onclick="dp_menu()" class="button">Drop</button>
<div style="display: none;" id="drop-content">
<a hreaf='#'>Menu1</a>
<a hreaf='#'>Menu2</a>
<a hreaf='#'>Menu3</a>
<a hreaf='#'>Menu4</a>
<a hreaf='#'>Menu5</a>
</div>
</div>
<script>
function dp_menu(){
let click = document.getElementById("drop-content");
if(click.style.display === "none"){
click.style.display = "block";
}else{
click.style.display = "none";
}
}
</script>
</body>
</html>
|
cs |
'Web' 카테고리의 다른 글
간단한 프로그레스 바(progress bar) 만들기(HTML, CSS, JAVASCRIPT (0) | 2020.07.21 |
---|---|
메뉴바(menubar) 만들기(HTML, CSS, JAVASCRIPT) (0) | 2020.07.15 |