<div class='flex'>
<p class='p'>Expanding hamburger menu that displays the intent of the button more clearly than a typical hamburger menu icon.</p>
<div class='wrapper'>
<div class='bun'>
<div class='bigmac'>
<span class='meat'>MENU</span>
</div>
</div>
</div>
</div>
@import url(https://fonts.googleapis.com/css?family=Lato);
//vars
$primary : #F5F8DE;
$secondary : #9E2B25;
$menu : $secondary;
//
* {
box-sizing : border-box;
}
body {
width : 100%;
height : 100%;
background-color : $primary;
}
.p {
max-width : 740px;
padding : 20px;
margin : 50px auto 0;
font-family : 'Lato', sans-serif;
font-size : 1.5em;
line-height : 1.5;
color : $secondary;
}
.wrapper {
width : 60px;
margin : 0 auto;
}
.bigmac {
position : absolute;
top : 27px;
left : 10px;
height : 6px;
width : 40px;
background-color : $secondary;
transition : background-color 100ms ease-in;
&::before {
content : '';
position : absolute;
top : -12px;
left : 0;
height : 6px;
width : 40px;
background-color : $secondary;
transition : all 150ms ease-in-out;
}
&::after {
content : '';
position : absolute;
bottom : -12px;
left : 0;
height : 6px;
width : 40px;
background-color : $secondary;
transition : all 150ms ease-in-out;
}
.meat {
height : 60px;
width : 60px;
position : absolute;
top : -27px;
left : -10px;
font-family : 'Lato', sans-serif;
font-size : 0em;
line-height : 60px;
text-align : center;
text-decoration : none;
color : $menu;
cursor : pointer;
user-select : none;
z-index : 2;
transition : font-size 275ms ease-out;
}
}
.bun {
position : relative;
width : 60px;
height : 60px;
&:hover {
.bigmac {
background-color : transparent;
.meat {
font-size : 1.25em;
}
&::before {
width : 60px;
left : -10px;
top : -22px;
}
&::after {
width : 60px;
left : -10px;
bottom : -22px;
}
}
}
}
@media screen and (max-width : 30em) {
.bigmac {
background-color : transparent;
.meat {
font-size : 1.25em;
}
&::before {
width : 60px;
left : -10px;
top : -22px;
}
&::after {
width : 60px;
left : -10px;
bottom : -22px;
}
}
}
.flex {
display: flex;
flex-direction: column;
}
View Compiled
let burger = document.querySelector('.meat');
burger.addEventListener('click', () => {
burger.textContent === "MENU" ? burger.textContent = "CLOSE" : burger.textContent = "MENU";
});
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.