In this video, you are going to learn how to design a menu icon with a transform spin to close icon only using CSS and HTML. This transform menu icon will be helpful with you designing a sidebar menu, navigation menu like open and closing menu. Let’s see how to design this transform menu icon.


Source code


<!DOCTYPE html>
<html lang="en" dir="ltr">
		<meta charset="utf-8">
		<title>Menu Icon Transform</title>
		<link rel="stylesheet" href="style.css">

		<!--menu icon start-->
		<input type="checkbox" id="check">
		<label class="menu" for="check">
			<div class="bar"></div>
			<div class="bar"></div>
			<div class="bar"></div>
		<!--menu icon end-->



  margin: 0;
  padding: 0;
  background: #FF6B81;

  position: absolute;
  height: 50px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: 0.5s;

.menu .bar{
  background: #fff;
  width: 60px;
  height: 10px;
  box-shadow: 0 0 10px 0 rgba(255, 255, 255, 0.5);
  border-radius: 2px;
  transition: 0.4s;

.menu .bar:not(:first-child){
  margin-top: 10px;

.menu:hover .bar{
  box-shadow: 0 0 25px 0 rgba(255, 255, 255, 0.5);

#check:checked + .menu{
  transform: translate(-50%, -50%) rotateY(180deg);

#check:checked + .menu .bar:nth-child(1){
  margin-top: 20px;
  transform: rotate(-45deg);

#check:checked + .menu .bar:nth-child(2){
  opacity: 0;

#check:checked + .menu .bar:nth-child(3){
  margin-top: -30px;
  transform: rotate(45deg);

  display: none;

#html #css

Menu Icon with a Transform Spin Only Using CSS & HTML
4.70 GEEK