I have a sticky navigation bar with the tab "categories" that reveals the dropdown menu "categoriesDropdown" when hovered over.
I want the dropdown menu to span the width of the screen and be centered on it.
I also need the dropdown menu to stick to the bottom of the navigation bar.
However, I am facing an issue where I can only center the dropdown menu relative to its parent div (categories). The code snippet I am using is displayed below:
<div class="categories">
<a>Categories</a>
<div id="categoriesDropdown"></div>
</div>
CSS:
.categories {
padding-left: 20px;
padding-right: 20px;
height: 45px;
display: inline-block;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
#categoriesDropdown {
position: absolute;
background: #1d1d1d;
width: 100vw;
height: 0px;
z-index: -1;
overflow: auto;
}
#categoriesDropdown.show {
height: 500px;
}
Edit: When I try to use left: 0; right: 0; the grey square represents the drop-down menu.