Can anyone assist me with a menu creation challenge? I am attempting to create a menu with submenus that can be opened without the use of javascript or jquery. Is it possible to achieve this using only CSS?
<nav id="container">
<ul>
<li><a href="">Link1</a></li>
<li class="haschildren selected">
<a>Link2</a>
<ul class="submenu">
<li><a href="">Link2-1</a></li>
<li><a href="">Link2-2</a></li>
<li><a href="">Link2-3</a></li>
</ul>
</li>
<li class="haschildren">
<a>Link3</a>
<ul class="submenu">
<li><a href="">Link3-1</a></li>
<li><a href="">Link3-2</a></li>
<li><a href="">Link3-2</a></li>
</ul>
</li>
</ul>
</nav>
I am encountering an issue where the selected submenu remains open even when hovering over another list item with a submenu. Ideally, I would like the current submenu to hide and the new one to appear upon hover. Any guidance on achieving this behavior is greatly appreciated.
You can view my example here: https://jsfiddle.net/ef8zgogr/