I'm trying to create a responsive menu where the hamburger icon pops up under 640px width screen -- the menu mostly works but I cannot figure out how to get my menu items "About," "Work," and "Resume" to appear beneath the hamburger icon - it always overlaps. I currently have a background color on to at least make it appear clean but I'd appreciate any help on the positioning issue. Thank you in advance!
CSS (sorry for the inelegant code, still new to all of this):
/* ----------------- NAVIGATION ----------------- */
.header_nav {
display: inline-table;
list-style: none;
background-color: #fffef9f7;
height: 75px;
position: fixed;
top: 0;
width: 100%;
z-index: 1;
}
.header_nav ul, .header_nav a {
list-style: none;
display: inline-block;
text-decoration: none;
font-weight: 600;
font-size: 28px;
text-transform: uppercase;
}
ul {
display: block !important;
list-style-type: disc !important;
margin-block-start: 1em !important;
margin-block-end: 1em !important;
margin-inline-start: 0px !important;
margin-inline-end: 0px !important;
padding-inline-start: 40px !important;
}
.header_nav a:hover {
color: #78F51D;
}
.logo {
display: inline-block;
padding-left: 5%;
padding-top: 25px;
}
.logo img {
max-height: 45px;
}
.menu {
display: inline-block;
float: right;
padding-right: 5%;
padding-top: 2px;
}
.menu li {
padding-left: 20px;
}
.menu .icon {
display: none;
}
li .icon {
padding-right: 0px;
}
li {
padding-left: 12px;
display: inline-block;
}
/* ----------------- MEDIA QUERIES ----------------- */
@media only screen and (max-width: 640px) {
.menu ul li:not(.icon) {display: none;}
.menu ul li.icon {
float: right;
display: block;
right: 25px;
top: 25px;
}
.menu.responsive {
background-color:#FFFEF9;
position: relative;
}
.menu.responsive .icon {
position: absolute;
right: 25px;
top: 25px;
z-index: -1;
}
.menu.responsive ul li:not(.icon) {
float: none;
display: block;
top: 100px;
padding-right: 1%;
text-align: right;
}
}
HTML:
<div class="header_nav">
<div class="logo">
<a href="index.html"><img src="images/logo_v3.png"></a>
</div>
<div class="menu" id="myMenunav">
<ul>
<li><a href="about.html">ABOUT </a></li>
<li><a href="index.html#work">WORK </a></li>
<li><a href="Resume.pdf" target="_blank">RESUME </a></li>
<li class="icon"><a href="javascript:void(0);" onclick="myFunction()">
<i class="fa-solid fa-burger"></i></a></li>
</ul>
</div>
</div>