Whenever I am hovering my mouse over a menu, I want it to show a drop down menu but instead I get this weird glitchy effect, Is there something wrong with my code?
For example if I hover my mouse over menu, the drop down menu will appear but then the main menus will go down down as well until I stop hovering over the main menu.
body {
text-align: center;
margin: 0;
background-color: white;
}
nav {
position: fixed;
width: 100%;
height: 100px;
background-color: rgba(0, 0, 0, 0.2);
z-index: 99;
color: white;
}
nav li {
display: inline-block;
list-style: none;
margin-left: 40px;
font-size: 25px;
line-height: 80px;
}
nav a {
color: white;
font-family: arial;
text-decoration: none;
}
nav a:hover {
border-bottom-color: #29b26b;
border-bottom-style: solid;
border-bottom-width: 100%;
}
nav ul li ul li {
display: none;
background-color: black;
}
nav ul li:hover ul li {
display: block;
}
<nav>
<ul>
<li><a href="#">Home</a>
<ul>
<li><a href="#">Button 1</a></li>
<li><a href="#">Button 2</a></li>
</ul>
</li>
<li><a href="#">About Us</a>
<ul>
<li><a href="#">Button 1</a></li>
<li><a href="#">Button 2</a></li>
</ul>
</li>
<li><a href="#">The Team</a>
<ul>
<li><a href="#">Button 1</a></li>
<li><a href="#">Button 2</a></li>
</ul>
</li>
</ul>
</nav>