JSFiddle - React, Tailwind, and code Playground
HTML
<div id="mobile_menu">
<label for="show-menu" class="show-menu lines"></label>
<input type="checkbox" id="show-menu" role="button">
<ul id="menu">
<li><a href="#">Features</a></li>
<li>
<a href="#">Solutions ↓</a>
<ul class="hidden">
<li><a href="#">Who We Are</a></li>
<li><a href="#">What We Do</a></li>
</ul>
</li>
<li>
<a href="#">Pricing ↓</a>
<ul class="hidden">
<li><a href="#">Photography</a></li>
<li><a href="#">Web & User Interface Design</a></li>
<li><a href="#">Illustration</a></li>
</ul>
</li>
<li><a href="#">Resources</a></li>
<li>
<a href="#">About ↓</a>
<ul class="hidden">
<li><a href="#">Contact Us</a></li>
<li><a href="#">Company</a></li>
<li><a href="#">Carrers</a></li>
</ul>
</li>
</ul>
</div>
CSS
/* mobile menu*/
#mobile_menu ul {
list-style-type:none;
margin:0;
padding:0;
position: absolute;
}
/*Create a horizontal list with spacing*/
#mobile_menu li {
display:inline-block;
float: left;
margin-right: 1px;
}
/*Style for menu links*/
#mobile_menu li a {
display:block;
min-width:140px;
height: 50px;
text-align: center;
line-height: 50px;
background: #6aa7ba;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #fff;
text-decoration: none;
border-top: 1px solid #43839b;
border-bottom:1px solid #91cbd9;
}
/*Hover state for top level links*/
#mobile_menu li:hover a {
background: #99c6d3;
}
/*Style for dropdown links*/
#mobile_menu li:hover ul a {
background: #60a0b2;
color: #ffffff;
height: 40px;
line-height: 40px;
}
/*Hover state for dropdown links*/
#mobile_menu li:hover ul a:hover {
background: #7fb5c6;
color: #b3d6da;
}
/*Hide dropdown links until they are needed*/
#mobile_menu li ul {
display: none;
}
/*Make dropdown links vertical*/
#mobile_menu li ul li {
display: block;
float: none;
}
/*Prevent text wrapping*/
#mobile_menu li ul li a {
width: auto;
min-width: 100px;
padding: 0 20px;
}
/*Display the dropdown on hover*/
#mobile_menu ul li:hover > .hidden, .hidden:hover {
display: block;
}
/*Style 'show menu' label button and hide it by default*/
.show-menu {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
text-decoration: none;
color: #fff;
text-align: center;
width: 15px;
padding: 10px;
display: none;
}
.lines{position: relative; padding-left: 1.25em;}
.lines:before {content: "";
position: absolute;
left: 0;
top: 0.25em;
width: 1em;
height: 0.15em;
background: black;
box-shadow:
0 0.25em 0 0 black,
0 0.5em 0 0 black;}
/*Hide checkbox*/
input[type=checkbox]{
display: none;
}
/*Show menu when invisible checkbox is checked*/
input[type=checkbox]:checked ~ #menu{
display: block;
}
@media screen and (max-device-width: 1000px), screen...
JavaScript
$("label").click(function() {
$("body").css('background: red;');
});