How To Make Menu Icon in website With Example
code , Icon Menu for website, Icon Menu for developer, website design , web for Menu Icons Create
Step 1) Add HTML:Example :
<div></div>
<div></div>
<div></div>
Step 2) Add CSS:
Example :
div {
width: 35px;
height: 5px;
background-color: black;
margin: 6px 0;
}
Animated Icon
Step 1) Add HTML:
Example :
<div class="container" onclick="myFunction(this)">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
</div>
Step 2) Add CSS:
Example
.container {
display: inline-block;
cursor: pointer;
}
.bar1, .bar2, .bar3 {
width: 35px;
height: 5px;
background-color: #333;
margin: 6px 0;
transition: 0.4s;
}
/* Rotate first bar */
.change .bar1 {
-webkit-transform: rotate(-45deg) translate(-9px, 6px) ;
transform: rotate(-45deg) translate(-9px, 6px) ;
}
/* Fade out the second bar */
.change .bar2 {
opacity: 0;
}
/* Rotate last bar */
.change .bar3 {
-webkit-transform: rotate(45deg) translate(-8px, -8px) ;
transform: rotate(45deg) translate(-8px, -8px) ;
}
Step 3) Add JavaScript:
Example
function myFunction(x) {
x.classList.toggle("change");
}
Post a Comment