
Colorful Hamburger Icons
Before We Start to Colorful Hamburger Icons
Colorful Hamburger Icons can be used to animate a Cards, Buttons, etc. and create user attractive UI components.
So if you are a person who wishes to develop a website, you have to know how to create animations properly. Check out our tutorial and you can learn this techniques and use it on your web development. Below sections shows how to develop this animations.
How to create? We are here to solve your problem. In this article we discuss how to create a hover effect animations. Before we start please read the below articles which easier you to understand the process, if you are new to development.
Step 1 – Add HTML
It’s too easy and simple. Just copy and paste below code in your HTML editor between <body> </body> tag as below.
<body>
<div class="container">
<div class="row">
<div class="col-2 animated-icon1">
<div class="icon"></div>
</div>
<div class="col-2 animated-icon2">
<div class="icon"></div>
</div>
<div class="col-2 animated-icon3">
<div class="icon"></div>
</div>
<div class="col-2 animated-icon4">
<div class="icon"></div>
</div>
<div class="col-2 animated-icon5">
<div class="icon"></div>
</div>
</div>
</div>
</body>
Step 2 – Add CSS
Copy and paste below code in your HTML editor between <style></style> tag as below.
<style>
body>div {
margin: 10px;
}
.animated-icon1 {
background: #cac1eb;
cursor: pointer;
display: grid;
height: 40vw;
place-content: center;
width: 40vw;
}
.animated-icon1>* {
transition: 0s;
}
.animated-icon1 .icon {
background: #000;
height: 5vw;
position: relative;
transition-delay: 0.4s;
width: 30vw;
}
.animated-icon1 .icon::after,
.animated-icon1 .icon::before {
background: #000;
content: "";
display: block;
height: 5vw;
position: absolute;
transition: top 0.4s 0.4s, transform 0.4s 0s;
width: 30vw;
}
.animated-icon1 .icon::after {
top: 10vw;
}
.animated-icon1 .icon::before {
top: -10vw;
}
.animated-icon1.active {
display: grid;
place-content: center;
}
.animated-icon1.active .icon {
background: transparent;
position: relative;
}
.animated-icon1.active .icon::after,
.animated-icon1.active .icon::before {
transition: top 0.4s 0s, transform 0.4s 0.4s;
}
.animated-icon1.active .icon::after {
top: 0;
transform: rotate(45deg);
}
.animated-icon1.active .icon::before {
top: 0vw;
transform: rotate(-45deg);
}
@media (min-width: 480px) {
.animated-icon1 {
height: 120px;
width: 120px;
}
.animated-icon1 .icon {
height: 13px;
width: 70px;
}
.animated-icon1 .icon::after,
.animated-icon1 .icon::before {
height: 13px;
width: 70px;
}
.animated-icon1 .icon::after {
top: 25px;
}
.animated-icon1 .icon::before {
top: -25px;
}
}
.animated-icon2 {
background: #0e7ce7;
cursor: pointer;
display: grid;
height: 40vw;
place-content: center;
width: 40vw;
}
.animated-icon2>* {
transition: 0.4s;
}
.animated-icon2 .icon {
background: #000;
height: 5vw;
position: relative;
width: 30vw;
}
.animated-icon2 .icon::after,
.animated-icon2 .icon::before {
background: #000;
content: "";
display: block;
height: 5vw;
position: absolute;
transition: top 0.4s 0.4s, transform 0.4s 0s;
width: 30vw;
}
.animated-icon2 .icon::after {
top: 10vw;
}
.animated-icon2 .icon::before {
top: -10vw;
}
.animated-icon2.active {
display: grid;
place-content: center;
}
.animated-icon2.active .icon {
background: transparent;
position: relative;
transform: rotate(180deg);
}
.animated-icon2.active .icon::after,
.animated-icon2.active .icon::before {
transition: top 0.4s 0s, transform 0.4s 0.4s;
}
.animated-icon2.active .icon::after {
top: 0;
transform: rotate(45deg);
}
.animated-icon2.active .icon::before {
top: 0vw;
transform: rotate(-45deg);
}
@media (min-width: 480px) {
.animated-icon2 {
height: 120px;
width: 120px;
}
.animated-icon2 .icon {
height: 13px;
width: 70px;
}
.animated-icon2 .icon::after,
.animated-icon2 .icon::before {
height: 13px;
width: 70px;
}
.animated-icon2 .icon::after {
top: 25px;
}
.animated-icon2 .icon::before {
top: -25px;
}
}
.animated-icon3 {
background: #007540;
cursor: pointer;
display: grid;
height: 40vw;
place-content: center;
transition: 0.4s;
width: 40vw;
}
.animated-icon3 * {
transition: 0.4s;
}
.animated-icon3 .icon {
background: #fff;
height: 5vw;
position: relative;
width: 30vw;
}
.animated-icon3 .icon::after,
.animated-icon3 .icon::before {
background: #fff;
content: "";
display: block;
height: 5vw;
position: absolute;
transition: 0.4s;
width: 30vw;
}
.animated-icon3 .icon::after {
top: 10vw;
}
.animated-icon3 .icon::before {
top: -10vw;
}
.animated-icon3.active {
background: #d1d1d1;
display: grid;
place-content: center;
}
.animated-icon3.active .icon {
background: transparent;
position: relative;
transform: rotate(180deg);
}
.animated-icon3.active .icon::after,
.animated-icon3.active .icon::before {
background: #af1c26;
}
.animated-icon3.active .icon::after {
top: 0;
transform: rotate(135deg);
}
.animated-icon3.active .icon::before {
top: 0vw;
transform: rotate(45deg);
}
@media (min-width: 480px) {
.animated-icon3 {
height: 120px;
width: 120px;
}
.animated-icon3 .icon {
height: 13px;
width: 70px;
}
.animated-icon3 .icon::after,
.animated-icon3 .icon::before {
height: 13px;
width: 70px;
}
.animated-icon3 .icon::after {
top: 25px;
}
.animated-icon3 .icon::before {
top: -25px;
}
}
.animated-icon4 {
background: #7dc774;
cursor: pointer;
display: grid;
height: 40vw;
place-content: center;
transition: 0.4s;
width: 40vw;
}
.animated-icon4>* {
transition: 0.4s;
}
.animated-icon4 .icon {
background: #000;
height: 5vw;
position: relative;
width: 30vw;
}
.animated-icon4 .icon::after,
.animated-icon4 .icon::before {
background: #000;
content: "";
display: block;
height: 5vw;
position: absolute;
transition: 0.4s;
width: 30vw;
}
.animated-icon4 .icon::after {
top: 10vw;
}
.animated-icon4 .icon::before {
top: -10vw;
}
.animated-icon4.active {
background: #00d1bf;
display: grid;
place-content: center;
}
.animated-icon4.active .icon {
background: transparent;
position: relative;
}
.animated-icon4.active .icon::after,
.animated-icon4.active .icon::before {
transition: 0.4s;
}
.animated-icon4.active .icon::after {
top: 0;
transform: rotate(45deg);
}
.animated-icon4.active .icon::before {
top: 0vw;
transform: rotate(135deg);
}
@media (min-width: 480px) {
.animated-icon4 {
height: 120px;
width: 120px;
}
.animated-icon4 .icon {
height: 13px;
width: 70px;
}
.animated-icon4 .icon::after,
.animated-icon4 .icon::before {
height: 13px;
width: 70px;
}
.animated-icon4 .icon::after {
top: 25px;
}
.animated-icon4 .icon::before {
top: -25px;
}
}
.animated-icon5 {
background: #b9e7a0;
cursor: pointer;
display: grid;
height: 40vw;
place-content: center;
width: 40vw;
}
.animated-icon5>* {
transition: 0.4s;
}
.animated-icon5 .icon {
background: #000;
height: 5vw;
position: relative;
width: 30vw;
}
.animated-icon5 .icon::after,
.animated-icon5 .icon::before {
background: #000;
content: "";
display: block;
height: 5vw;
position: absolute;
transition: 0.4s;
width: 30vw;
}
.animated-icon5 .icon::after {
top: 10vw;
}
.animated-icon5 .icon::before {
top: -10vw;
}
.animated-icon5.active {
display: grid;
place-content: center;
}
.animated-icon5.active .icon {
background: transparent;
position: relative;
}
.animated-icon5.active .icon::after,
.animated-icon5.active .icon::before {
transition: 0.4s;
}
.animated-icon5.active .icon::after {
top: 0;
transform: rotate(45deg);
}
.animated-icon5.active .icon::before {
top: 0vw;
transform: rotate(-45deg);
}
@media (min-width: 480px) {
.animated-icon5 {
height: 120px;
width: 120px;
}
.animated-icon5 .icon {
height: 13px;
width: 70px;
}
.animated-icon5 .icon::after,
.animated-icon5 .icon::before {
height: 13px;
width: 70px;
}
.animated-icon5 .icon::after {
top: 25px;
}
.animated-icon5 .icon::before {
top: -25px;
}
}
</style>
At the end we will have something like this. You can change fonts, colors, backgrounds and all things that you want. Enjoy it.
Step 3 – Add JavaScript
We use some external JS to this code. No need to worry about this, copy and paste below code to the bottom of <body></body> tag. Before </body> closing tag.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/jquery-3.7.1.js"></script>
Copy and paste below code in your HTML editor between <script></script> tag.
<script>
'use strict'
// animated icon 1 -start
let icon1 = document.querySelector('.animated-icon1')
icon1.onclick = function() {
icon1.classList.toggle('active')
}
// animated icon 1 -end
// animated icon 2 -start
let icon2 = document.querySelector('.animated-icon2')
icon2.onclick = function() {
icon2.classList.toggle('active')
}
// animated icon 2 -end
// animated icon 3 -start
let icon3 = document.querySelector('.animated-icon3')
icon3.onclick = function() {
icon3.classList.toggle('active')
}
// animated icon 3 -end
// animated icon 4 -start
let icon4 = document.querySelector('.animated-icon4')
icon4.onclick = function() {
icon4.classList.toggle('active')
}
// animated icon 4 -end
// animated icon 5 -start
let icon5 = document.querySelector('.animated-icon5')
icon5.onclick = function() {
icon5.classList.toggle('active')
}
// animated icon 5 -end
</script>
Out Put


Video Tutorial
Please watch this video to better understand this tutorial and don’t forget to subscribe to our channel.
Help others to find out about this article on Social Media sites. If you have any doubt or any problem, don’t hesitate to contact us. Thereafter we will be able to help you and also make sure you bookmark our site on your browser.