Skip to content

Commit 4a89333

Browse files
author
guldus98
committed
Accordion Menu 1
1 parent 3498157 commit 4a89333

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed

accordion menu 1/accordion menu 1.css

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
body{
2+
padding: 0;
3+
margin: 0;
4+
background: #fff;
5+
}
6+
.container {
7+
position: absolute;
8+
top: 50%;
9+
left: 50%;
10+
width: 600px;
11+
height: auto;
12+
transform: translate(-50%,-50%);
13+
transition: .5s;
14+
}
15+
h2{
16+
text-align:center;
17+
font-family: arial;
18+
font-weight: bolder;
19+
}
20+
.accordion {
21+
text-align: left;
22+
outline: none;
23+
padding: 20px;
24+
width: 100%;
25+
border: none;
26+
font-family: Verdana, sans-serif;
27+
font-weight: bold;
28+
font-size: 18px;
29+
color: #ccc;
30+
background: #1a1a1a;
31+
box-shadow: 0px 0px 20px #262626;
32+
border: 2px solid #ccc;
33+
transition: .4s;
34+
}
35+
#box{
36+
padding: 5px 20px;
37+
background: rgba(255, 255, 255, 0.1);
38+
color: #262626;
39+
font-family: Arial;
40+
overflow: hidden;
41+
display: none;
42+
}
43+
.active{
44+
background: #ccc;
45+
color: #262626;
46+
transition: .5s;
47+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<!DOCTYPE html>
2+
3+
<html>
4+
<head>
5+
<meta charset="utf-8" />
6+
<title>page</title>
7+
<link rel="stylesheet" type="text/css" href="accordion menu 1.css">
8+
<meta name="viewport" content="width=device-width, initial-scale=1">
9+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css">
10+
<style>
11+
</style>
12+
</head>
13+
<body>
14+
15+
16+
<div class="container">
17+
<h2>WEB LANGUAGES</h2>
18+
<button class="accordion">HTML</button>
19+
<div id="box">
20+
<p>
21+
Hypertext Markup Language is the standard text markup
22+
language used to create web pages. The last version of the
23+
language is HTML5. HTML cannot be defined as a programming language.
24+
Because a program that works on its own with HTML code can not be written.
25+
</p>
26+
</div>
27+
28+
<button class="accordion">CSS</button>
29+
<div id="box">
30+
<p>
31+
Cascading Style Sheets is a Web technology that offers additional
32+
possibilities for formatting text and formats in addition to HTML.
33+
</p>
34+
</div>
35+
36+
<button class="accordion">JavaScript</button>
37+
<div id="box">
38+
<p>
39+
JavaScript® (usually abbreviated as js) is an object-oriented programming
40+
language that is simply interpreted and blended with first-class functions.
41+
It is commonly known as a scripting language for web pages, but is often
42+
used in non-browser environments such as node.js or Apache CouchDB. Having
43+
a prototype-based and multi-paradigm language provides a dynamic and
44+
functional structure. Learn more about JavaScript.
45+
</p>
46+
</div>
47+
</div>
48+
49+
50+
51+
<script>
52+
53+
let acordion = document.getElementsByClassName("accordion");
54+
55+
56+
for (let i = 0; i < acordion.length; i++) {
57+
acordion[i].addEventListener("click", function () {
58+
this.classList.toggle("active");
59+
let box = this.nextElementSibling;
60+
if (box.style.display === "none") {
61+
box.style.display = "block";
62+
}
63+
else {
64+
box.style.display = "none"
65+
}
66+
})
67+
};
68+
69+
70+
</script>
71+
72+
</body>
73+
</html>

accordion menu 1/accordion menu 1.png

40.3 KB
Loading

0 commit comments

Comments
 (0)