JSFiddle - React, Tailwind, and code Playground
by zoldello
HTML
<svg id="ham-btn" width="107.5px" height="80px" viewBox="0 0 80 80" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg">
<style>
#ham-btn {
cursor: pointer;
}
#ham-btn:hover #r1 {
transition: transform 0.2s;
transform-origin: 50% 50%;
transform: rotate(37deg) translate(0%, 28.75%) scaleX(1.1);
}
#ham-btn:hover #r2 {
transition: x 0.2s;
x: 120%;
}
#ham-btn:hover #r3 {
transition: transform 0.2s;
transform-origin: 50% 50%;
transform: rotate(-37deg) translate(0%, -28.75%) scaleX(1.1);
}
</style>
<rect id="r3" x="0" y="71.25%" width="100" height="15" rx="5" />
<rect id="r2" x="0" y="42.5%" width="100%" height="15%" rx="5%"/>
<rect id="r1" x="0" y="13.75%" width="100%" height="15%" rx="5%" />
</svg>
CSS
body {
margin: 0;
text-align: center;
}
svg#ham-btn {
margin: 2rem;
border: 1px solid black;
fill: #383838;
/* percentage of viewport - height will autocalculate */
width: 7vw;
height: auto;
}