I am trying to make a full page overlay when I hover on my navbar menu ul
the overlay div is on the top of the page
When I hover on the ul the li links appear but the overlay doesn't.
How can I make appear the overlay using CSS only can anybody help?
This is the HTML and CSS code the full code of the header whith the span icons, ul and li. My intention is that when I hover on the ul the li links appear like in the code below and the overlay appear now only the li links appear
.header .container .row {
display: flex;
align-items: center;
justify-content: space-between;
}
.header .container .row img {
max-width: 207px;
max-height: 207px;
}
.header .container .row .links {
position: relative;
z-index: 1;
}
.header .container .row .links .icon {
width: 1.875em;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
cursor: pointer;
}
.header .container .row .links .icon span {
background-color: var(--whiteColor);
margin-bottom: 0.3125em;
height: 0.125em;
background-color: #000;
}
.header .container .row .links .icon span:first-child {
width: 100%;
}
.header .container .row .links .icon span:nth-child(2) {
width: 100%;
}
.header .container .row .links .icon span:last-child {
width: 60%;
transition: 0.3s
}
.header .container .row .links:hover .icon span:last-child {
width: 100%;
}
.header .container .row .links ul {
display: none;
background-color: #000;
position: absolute;
min-width: 12.5em;
right: 0;
top: calc(100% + 15px);
z-index: 1;
}
.header .container .row .links ul::before {
content: " ";
position: absolute;
border-width: 0.625em;
border-style: solid;
border-color: transparent transparent #000 transparent;
right: 0.3125em;
top: -1.25em;
}
.header .container .row ul li {
padding: 1em;
}
.header .container .row ul li a {
text-transform: capitalize;
color: var(--whiteColor);
transition: color .3s ease-in-out;
}
.header .container .row ul li a:hover {
color: var(--grayColor);
}
.header .container .row .links:hover ul,
.header .container .row .links:hover .overlay{
display: block;
}
.overlay {
display: none;
position: fixed;
background-color: rgba(0,0,0,0.7);
width: 100%;
height: 100%;
z-index: 10;
}
.container {
max-width: 1140px;
margin-left: auto;
margin-right: auto;
padding-right: 0.8em;
padding-left: 0.8em;
}
<div class="overlay"></div>
<header class="header">
<div class="container">
<div class="row">
<img src="https://images01.nicepage.com/51/41/51417a6d3ee82530e9117219a42fd762.png">
<div class="links">
<span class="icon">
<span></span>
<span></span>
<span></span>
</span>
<ul>
<li><a href="#">home</a></li>
<li><a href="#">menu</a></li>
<li><a href="#">catering</a></li>
<li><a href="#">our menu</a></li>
<li><a href="#">our team</a></li>
<li><a href="#">contact us</a></li>
</ul>
</div>
</div>
</div>
</header>