I am trying to create a very simple hover/drop menu using DIVs, no UL/LI. My current code shows the menu with 3 options, but what I need is to have a submenu under Link 2. Here is my current code.
.dropbtn { background-color: #4CAF50; color: white; padding: 0px; font-size: 12px; border: none; cursor: pointer; } .dropdown { margin-top:200px; position: relative; display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #f9f9f9; min-width: 30px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; } .dropdown-content a:hover { background-color: #f1f1f1; } .dropdown:hover .dropdown-content { display: block; bottom: 100%; } .dropdown:hover .dropbtn { background-color: #3e8e41; } .subdiv { display:none; } .dropdown:hover .subdiv { display:block; } <div class="dropdown"> <button class="dropbtn">^</button> <div class="dropdown-content"> <a href="#">Link 1</a> <a href="#">Link 2</a> <a href="#">Link 3</a> </div> </div> What I would like to do is this:
<div class="dropdown"> <button class="dropbtn">^</button> <div class="dropdown-content"> <a href="#">Link 1</a> <a href="#">Link 2</a> <div class="submenu"> <a href="#">SubLink 1</a> </div> <a href="#">Link 3</a> </div> </div> Where the SubLink 1 item shows up when you hover over Link 2, but everything I have tried doesn't work, so I'm hoping someone else can help.