Below is the code for my dropdown button with an additional level.
Initially, the button works as intended. However, upon attempting to click within the dropdown submenu, I noticed that all four items displayed the same last submenu only.
.icon-cadet-left {
float: right;
}
.dropbtn {
width: 300px;
background-color: #4CAF50;
color: white;
padding: 16px;
font-family: 'Play';
font-size: 20px;
border: none;
cursor: pointer;
text-transform: uppercase;
letter-spacing: 2px;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: relative;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
width: 300px;
color: black;
font-family: 'Play';
letter-spacing: 2px;
padding: 12px 16px;
text-decoration: none !important;
display: block;
text-align: center;
border-bottom: 0.1em solid #e1e1e1;
border-radius: 5%;
text-transform: uppercase;
overflow: hidden;
}
#dropdown-submenu {
display: none;
background-color: #f9f9f9;
position: absolute;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
left: 100%;
top: 0px;
}
#dropdown-submenu a {
z-index: 1000;
width: 300px;
color: black;
font-family: 'Play';
letter-spacing: 2px;
padding: 12px 16px;
text-decoration: none !important;
display: block;
text-align: center;
border-bottom: 0.1em solid #e1e1e1;
border-radius: 5%;
text-transform: uppercase;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
#dropdown-submenu a:hover {
background-color: #f1f1f1
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown-content:hover #dropdown-submenu {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
<div class="pricing-button">
<div class="dropdown">
<button class="dropbtn">Logo Design</button>
<div class="dropdown-content animated fadeIn">
<a class="span1" href="#">Logo & Identity<i class="fa fa-caret-right icon-cadet-left"></i></a>
<div id="dropdown-submenu">
<a>Logo Design</a>
<a>Business Cards</a>
<a>Sationary</a>
<a>Holiday Doodles</a>
</div>
<a class="hover2" href="#">Business & Advertising<i class="fa fa-caret-right icon-cadet-left"></i></a>
<div id="dropdown-submenu">
<a>Sample 01</a>
<a>Sample 02</a>
<a>Sample 03</a>
<a>Sample 04</a>
</div>
<a class="hover3" href="#">Website & Digitals<i class="fa fa-caret-right icon-cadet-left"></i></a>
<div id="dropdown-submenu">
<a>Sample 01</a>
<a>Sample 02</a>
<a>Sample 03</a>
<a>Sample 04</a>
</div>
<a class="hover4" href="#">Textile Designing<i class="fa fa-caret-right icon-cadet-left"></i></a>
<div id="dropdown-submenu">
<a>Sample 01</a>
<a>Sample 02</a>
<a>Sample 03</a>
<a>Sample 04</a>
</div>
</div>
</div>
</div>