<nav class="mobile-menu">
    <input type="checkbox" id="checkbox" class="mobile-menu__checkbox">
    <label for="checkbox" class="mobile-menu__btn"><div class="mobile-menu__icon"></div></label>
    <div class="mobile-menu__container">
    <ul class="mobile-menu__list">
        <li class="mobile-menu__item"><a href="#" class="mobile-menu__link">Home</a></li>
        <li class="mobile-menu__item"><a href="#" class="mobile-menu__link">About us</a></li>
        <li class="mobile-menu__item"><a href="#" class="mobile-menu__link">Work</a></li>
        <li class="mobile-menu__item"><a href="#" class="mobile-menu__link">Contacts</a></li>
    </ul>
    </div>
</nav>
$primary-color: #27ae60;
$space-m: 16px;

.mobile-menu {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 $space-m;
  top: 0;
  background-color: $primary-color;
  left: 0;
  right: 0;
  height: 50px;
  z-index: 9999999;
  
  &__btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 30px;
    cursor: pointer;
    transition: .4s;
  }
  
  &__icon {
    display: block;
    position: relative;
    background: rgba(255,255,255,1);
    width: 90%;
    height: 4px;
    transition: .4s;

    &::after,
    &::before {
        content: "";
        display: block;
        position: absolute;
        background: rgba(255,255,255,1);
        width: 100%;
        height: 4px;
        transition: .4s;
    }
    &::after {
      top: 8px;
    }
    &::before {
      top: -8px;
    }
  }

  &__container {
    position: fixed;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 50px;
    left: 0;
    right: 0;
    z-index: 999;
    height: 0;
    opacity: 1;
    transition: .5s;
    transition-delay: .2s;
    overflow: hidden;
    background-color: $primary-color;
  }
  
  &__list {
    transition: .5s;
    transition-delay: .5s;
    list-style: none;
    padding-left: 0;
    margin-top: -50px;
  }

  &__item {
    font-size: 26px;
    padding-bottom: 15px;
  }

  &__link {
    text-decoration: none;
    color: #fff;
  }
 
  &__checkbox {
      display: none;

      &:checked ~ {
          .mobile-menu {

              &__nav {
                opacity: 1;
                transition-delay: 0s;
              }

              &__container {
                height: 100%;
                transition-delay: 0s;
              }

              &__btn {
                .mobile-menu__icon {
                    background: transparent;

                    &::before,
                    &::after {
                        top: 0;
                    }
  
                    &::after {
                      transform: rotate(-45deg);
                      -webkit-transform: rotate(-45deg);
                    }
  
                    &::before {
                      transform: rotate(45deg);
                      -webkit-transform: rotate(45deg);
                    }
                }
              }
          }
      }
    }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.