<nav>
<div class="toggleNav">
<div class="toggleNavButton"></div>
</div>
<div id="subnav">
<ul>
<li> <a href="#">Menu Item</a> </li>
<li> <a href="#">Menu Item</a> </li>
<li> <a href="#">Menu Item</a> </li>
<li> <a href="#">Menu Item</a> </li>
</ul>
</div>
</nav>
*{
transition-timing-function: ease-out; /* Safari and Chrome */
transition-timing-function: ease-out;
box-sizing: border-box;
text-decoration: none;
list-style: none;
padding: 0;
margin: 0;
}
body{
font-family: "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
color: #F2F2F2;
background-color: #41558C;
}
.toggleNav{
border-bottom: 5px solid darken(#54EFC9, 15%);
background-color: #54EFC9;
width: 100%;
height: 80px;
text-align: center;
line-height: 80px;
cursor: pointer;
color: white;
font-size: 30px;
&:hover{
border-bottom: 5px solid darken(#54EFC9, 20%);
}
}
nav{
width: 100%;
min-height: 50px;
}
.toggleNavButton{
transition-duration: 0.5s;
width: 40px;
height: 2px;
background-color: white;
position: absolute;
left: 50%;
top: 25px;
margin-left: -20px;
border-radius: 2px;
&:before, &:after{
border-radius: 2px;
transition-duration: 0.5s;
content: "";
position: absolute;
top: 10px;
left: 0;
background-color: white;
width: 40px;
height: 2px;
}
&:after{
top: 20px;
}
&.active{
width: 0;
&:after{
top: 10px;
transform: rotate(45deg);
transform: rotate(45deg);
}
&:before{
transform: rotate(-45deg);
transform: rotate(-45deg);
}
}
}
#subnav{
width: 100%;
border-bottom: 0px solid darken(#F64870, 15%);
background-color: #F64870;
transition-duration: 0.2s;
overflow: hidden;
height: 0px;
&.active{
border-bottom: 5px solid darken(#F64870, 15%);
height: 50px;
}
ul{
width: 615px;
margin: 0 auto;
li{
transition-duration: 0.3s;
display: inline-block;
text-align: center;
width: 150px;
padding: 10px 0;
height: 50px;
a{
color: white;
}
&:hover{
background-color: darken(#F64870, 15%);
}
}
}
}
View Compiled
$(".toggleNav").click(function () {
$("#subnav").toggleClass("active");
$(".toggleNavButton").toggleClass("active");
});
This Pen doesn't use any external CSS resources.