Since many years a GUI-standard are the menu-bars of applications with menus popping up, if you click or hover an entry in the menu-bar. Some websites implement this feature too, but they are using Javascript, as far as I can see. For different reasons Javascript can be a problem, so the question: Is this possible to implement without Javascript, only using HTML and CSS?
Create A SubnavUse any element to open the subnav/dropdown menu, e.g. a <button>, <a> or <p> element. Use a container element (like <div>) to create the subnav menu and add the subnav links inside it. Wrap a <div> element around the button and the <div> to position the subnav menu correctly with CSS.
<menu>: The Menu element The <menu> HTML element is described in the HTML specification as a semantic alternative to <ul> , but treated by browsers (and exposed through the accessibility tree) as no different than <ul> . It represents an unordered list of items (which are represented by <li> elements).
In the left sidebar menu, navigate to Website > Navigation. Your default menu contains the pages that will automatically populate the default content of an advanced menu module. Use the dropdown menu to select an existing menu to update. To create a new menu, click + Add menu.
I've done something like this before, and it's a trick pulled off by placing the menu items in anchor tags, with submenus in hidden divs INSIDE those anchor tags. The CSS trick is to make the inner div appear during the a:hover event.
It looks something like:
<style>
A DIV { display: none; }
A:hover DIV { display: block; }
</style>
<a href="blah.htm">
Top Level Menu Text
<div><ul>
<li><a href="sub1.htm">Sub Item 1</a></li>
<li><a href="sub2.htm">Sub Item 2</a></li>
<li><a href="sub3.htm">Sub Item 3</a></li>
</ul></div>
</a>
Your mileage may vary...
EDIT: Internet Explorer 6 and lower do NOT support the :hover pseudo-class on other elements besides A. In more 'modern' browsers, it is accepted to be able to use this trick with LI, TD, DIV, SPAN, and most any tag.
Have a look at CSS Menu Maker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With