I've been working on creating a customized navigation bar with sub menus using simple coding to keep it lightweight, but I'm encountering issues with the functionality. Could you please take a look at this code and fiddle link: Fiddle https://jsfiddle.net/tjmkf9sb/
My goal is to have hoverable submenus, but currently, they are not responding correctly to the display: none
property. Any assistance would be greatly appreciated.
CSS
.menu {
border: 1px solid aliceblue;
margin-top: 55px;
margin-left: auto;
}
.menu li {
list-style: none;
padding: 15px;
border-radius: 5px;
color: #fff;
background: red;
display: inline;
}
.menu li:hover {
background: red;
}
.menu a:hover {
text-decoration: none;
}
.menu li ul {
display: block;
}
.submenu ul {
display: none;
position: absolute;
}
HTML
<div class="menu">
<ul>
<a href="dashboard.php"><li>Dashboard</li></a>
<a href="dashboard.php">
<li class="submenu">
Licence Orders
<ul class="dropdown">
<li>Paid Orders</li>
<li>Unpaid Orders</li>
</ul>
</li>
</a>
<a href="dashboard.php"><li>Dashboard</li></a>
<a href="logout.php"><li>Logout</li></a>
</ul>
</div>
I would really appreciate any guidance or assistance as I've been struggling with this issue for some time now.