I'm new to web development and I'm trying to create a dropdown menu.
The issue is that when I hover over a specific element, it takes up more space than expected.
My goal is for it to appear below the "shop" element. I'm not sure where I've gone wrong.
.nav {
width: 100%;
float: right;
}
.nav ul {
/* styling for the list items */
float: right;
list-style-type: none;
display: block;
text-align: right;
}
.nav ul li {
display: inline-block;
margin: 20px 40px;
padding: 0 10px 0 10px;
text-align: center;
position: relative;
border: 2px solid gold;
}
.nav ul li a {
color: #000000;
text-decoration: none;
display: block;
}
.nav ul li ul li {
display: none;
margin: 0;
padding: 0;
border: 2px solid greenyellow;
}
.nav ul li:hover ul li {
display: block;
}
<div class="nav">
<ul>
<li><a href="#"&pgt;Home</a></li>
<li><a href="#"&rlt;Shop</a>
<ul>
<li><a href="#"&tit;Products</a></li>
<li><a href="#"&retitch;Membership</a></li>
</ul>
</li>
<li><a href="#"pt;Blog</a></li>
<li><a href="#"%gt;News</a></li>
<li>%wwwhref3g;"&tcthetAddress<%/a%9t;&ldign;4/li%&rtth&
</ulgt2%: