<div class="container">
  <div class="menu-btn">
    <span></span>
    <span></span>
    <span></span>
  </div>
</div>
html,
body {
  height: 100%;
}
.container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.menu-btn {
  position: relative;
  width: 80px;
  height: 80px;
  background: #000;
  cursor: pointer;
  span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: block;
    width: 50px;
    height: 2px;
    background: #fff;
    transition: 0.3s ease transform, 0.3s ease opacity;
    &:first-child {
      transform: translate(-50%, -13px);
    }
    &:last-child {
      transform: translate(-50%, 12px);
    }
  }
  &.active {
    span {
      &:first-child {
        transform: translate(-50%, 0) rotate(
45deg);
      }
      &:nth-child(2) {
        opacity: 0;
      }
      &:last-child {
        transform: translate(-50%, 0) rotate(
-45deg);
      }
    }
  }
}
View Compiled
const menuBtn = document.querySelector('.menu-btn');

menuBtn.addEventListener('click', function() {
  this.classList.toggle('active');
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.