I’m very new to all of this.
so, I have a side dropdown menu, that is supposed to overlap body content, but when I set any element in the main to position:fixed, the element begins to overlap the drop down, I successfully removed position from other elements except the bottom nav, which I need fixed to the bottom, so it won’t scroll with the body, but then it overlaps the dropdown.
Any idea how to resolve this ?
Html
<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>over lapping probs.</title>
</head>
<body>
<nav>
<div class="logo">
<i class="bx bx-menu menu-icon"></i>
<span class="logo-name">top nav</span> </div>
<div class="sidebar">
<div class="logo">
</div>
<div class="sidebar-content">
<p class="sideheadings">Menu</p>
<ul class="lists">
<li class="list">
<a href="#" class="nav-link">
<i class="bx bx-home-alt icon"></i>
<span class="link">Dashboard</span>
</a>
</li>
<li class="list">
<a href="#" class="nav-link">
<i class="bx bx-bar-chart-alt-2 icon"></i>
<span class="link">Services</span>
</a>
</li>
</ul>
<div class="bottom-content">
<p class="sideheadings">Others</p>
<li class="list">
<a href="#" class="nav-link">
<i class="bx bx-cog icon"></i>
<span class="link">Settings</span>
</a>
</li>
<li class="list">
<a href="#" class="nav-link">
<i class="bx bx-log-out icon"></i>
<span class="link">Logout</span>
</a>
</li>
</div>
</div>
<div class="©sidebar"><p class="©"><span class="num">©2023</span>over lap inc</p>
</div>
</nav>
<section class="overlay"></section>
<div class="main">
<p>
R<br>
A<br>
N<br>
D<br>
O<br>
M<br>
<br>
C<br>
O<br>
N<br>
T<br>
E<br>
N<br>
T<br>
<br>
T<br>
O<br>
<br>
S<br>
C<br>
R<br>
O<br>
L<br>
L<br>
<br>
P<br>
A<br>
G<br>
E<br>
</p>
</div>
<section class="footermenu">
<div class="footer">
<p>[FOOTER MENU CONTENT]-OVERLAPS</p>
</div>
</section>
Css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Poppins", sans-serif;
}
body {
min-height: 100%;
background: #e3f2fd;
}
nav {
position: fixed;
top: 0;
left: 0;
height: 45px;
width: 100%;
display: flex;
align-items: center;
box-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
background: #4070f4;
}
nav .logo {
display: flex;
align-items: center;
margin: 0 24px;
}
.logo .menu-icon {
color: #333;
font-size: 24px;
margin-right: 45px;
cursor: pointer;
}
.logo .logo-name {
color: #333;
font-size: 22px;
font-weight: 500;
text-align:center;
}
nav .sidebar {
position: fixed;
top: 0;
left: -100%;
height: 100%;
width: 260px;
background-color: #fff;
box-shadow: 0 5px 1px rgba(0, 0, 0, 0.1);
transition: all 0.4s ease;
z-index:9999;
}
nav.open .sidebar {
left: 0;
}
.sidebar .sidebar-content {
display: flex;
height: 100%;
flex-direction: column;
justify-content: space-between;
padding: 25px 10px;/*edit here - 30px 16px*/
overflow:scroll;
}
.sidebar-content .list {
list-style: none;
}
.list .nav-link {
display: flex;
align-items: center;
margin: 8px 0;
padding: 14px 12px;
border-radius: 8px;
text-decoration: none;
}
.lists .nav-link:hover {
background-color: #4070f4;
}
.nav-link .icon {
margin-right: 14px;
font-size: 20px;
color: #707070;
}
.nav-link .link {
font-size: 16px;
color: #707070;
font-weight: 400;
}
.lists .nav-link:hover .icon,
.lists .nav-link:hover .link {
color: #fff;
}
.overlay {
position: fixed;
top: 0;
left: -100%;
height: 1000vh;
width: 200%;
opacity: 0;
pointer-events: none;
transition: all 0.4s ease;
background: rgba(0, 0, 0, 0.3);
}
nav.open ~ .overlay {
opacity: 1;
left: 260px;
pointer-events: auto;
}
.main{
color:black;
font-size:20px 0 20px 0;
padding:50px;
text-align:center;
}
/**STYLE FOR THE BOTTOM MENU**/
.footermenu{
bottom:0%;
width:100%;
background: #4070f4;
overflow: hidden;
position:fixed;
}
JavaScript
const navBar = document.querySelector("nav"),
menuBtns = document.querySelectorAll(".menu-icon"),
overlay = document.querySelector(".overlay");
menuBtns.forEach((menuBtn) => {
menuBtn.addEventListener("click", () => {
navBar.classList.toggle("open");
});
});
overlay.addEventListener("click", () => {
navBar.classList.remove("open");
});

