I am trying to create a menu. What I would like is to have menu button that has the 3 lines (to signify its a menu).
When a user hovers over this button I want it to display two further buttons, lets call them button B & button C.
When a user hovers over button B or C I want it to display a list and when the user stops hovering over this list for it to not to be displayed.
This is my fiddle.
I have buttons B and C nearly doing what I require, the only part is that if a user clicks on the other button the list of the other button is still displayed, not sure how to correct this?
Lastly I don't know how to have the initial button with three lines expose my buttons B & C?
HTML
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8' />
<title>Floats</title>
<link rel='stylesheet' href='styles.css'/>
</head>
<body>
<div class='page'>
<div class='menu'>
<div class="sidenav">
<button class="dropdown-btn">Region</button>
<div class="dropdown-container">
<ul id="regionList">
<li>US</li>
<li>Japan</li>
<li>Europe</li>
</ul>
</div>
<button class="dropdown-btn">Export</button>
<div class="dropdown-container">
<ul id="exportList">
<li>Excel</li>
<li>CSV</li>
</ul>
</div>
</div>
</div>
<div class='sidebar'>Sidebar</div>
<div class='content'>Content</div>
<div class='footer'>Footer</div>
</div>
</body>
CSS
.menu {
height: 100px;
background-color: #B2D6FF; /* Medium blue */
}
.sidebar {
height: 300px;
background-color: #F09A9D; /* Red */
}
.content {
height: 500px;
background-color: #F5CF8E; /* Yellow */
}
.footer {
height: 200px;
background-color: #D6E9FE; /* Light blue */
}
.sidenav {
width: 20%;
position: relative;
z-index: 1;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
padding-top: 20px;
}
.sidenav li, .dropdown-btn {
padding: 6px 8px 6px 16px;
text-decoration: none;
font-size: 20px;
color: #818181;
display: block;
border: none;
background: none;
width:100%;
text-align: left;
cursor: pointer;
outline: none;
}
.sidenav li:hover, .dropdown-btn:hover {
color: #f1f1f1;
}
.main {
margin-left: 200px;
font-size: 20px;
padding: 0px 10px;
}
.active {
background-color: green;
color: white;
}
.dropdown-container {
display: none;
background-color: #262626;
padding-left: 8px;
}
ul{
padding-left: 0;
}