I have recently created a grid and flex-based menu. How can I make the hamburger menu function to show/hide the menu on click? Is there a way to achieve this without using JavaScript?
Here is the current code snippet:
.menu {
display: grid;
grid-template: auto / auto 3cm 3cm 3cm 3cm 3cm auto;
background: #444;
}
.menu-item {
padding: 10px;
text-align: center;
color: #fff;
}
.menu-item:hover {
background: #fff6;
}
.burger {
display: none;
padding: 10px;
background: #444;
color: #fff;
}
.burger > div {
text-align: center;
}
@media (max-width: 20cm) and (orientation: portrait) {
.menu {
max-width: 8cm;
grid-template: 0 auto auto auto auto auto 0 / auto;
}
.burger {
display: flex;
justify-content: space-between;
}
}
<div class="burger">
<div>BURG</div>
<div>Company Name</div>
</div>
<div class="menu">
<div></div>
<div class="menu-item">Home</div>
<div class="menu-item">Products</div>
<div class="menu-item">Manuals</div>
<div class="menu-item">Customers</div>
<div class="menu-item">Contact</div>
<div></div>
</div>