I'm creating a basis for a navigation bar. The menu can have multiple submenus within it. When a menu item with a submenu is clicked on the subMenu appears below. I have it mostly working except the nav doesnt take up the full width of the screen. When I try to center it the submenus break. I don't fully understand what I'm doing and I need some help understanding what is going on here and how to solve it. Thank you for any help given.
The menu for better understanding
nav {
display: flex;
font-weight: bold;
}
div {
display: inline-block;
}
li {
list-style: none;
}
li:not(.subMenu){
padding: 10px 20px;
}
.dropdown {
position: absolute;
}
<header>
<nav>
<ul>
<div>
<li id="About Me">About Me</li>
<ul class="dropdown">
<li id="Test" class="subMenu">Test</li>
<li id="Test2" class="subMenu">Test2</li>
</ul>
</div>
<div>
<li id="Projects">Projects</li>
</div>
<div>
<li id="Temp">Temp</li>
</div>
<div>
<li id="Helloooo">Helloooo</li>
<ul class="dropdown">
<li id="Test44" class="subMenu">Test44</li>
</ul>
</div>
</ul>
</nav>
</header>
edit: removing "display: flex" or attempting to use justify-content or align-items appears to do nothing