My website has a specific requirement where I need an overlay div to cover the entire body when hovering over the menu.
<header><menu><ul><li class="new-menu">menu1</li></menu></header>
<div id="myNav" class="overlay"></div>
<section id="content"></section>
This is a snippet of my HTML code. The header section contains the menu and submenu, while the body section contains the rest of the content.
.overlay {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
left: 0;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0, 0.58);
}
Currently, when hovering over the new-menu, the width of the overlay is set to 100% to create a black overlay across the entire website.
However, I only want the overlay to cover a specific section (#content). How can I achieve this while maintaining the sticky header functionality of my menu?