<header class="offcanvas-menu">
  <input type="checkbox" id="toogle-menu" />

  <label for="toogle-menu" class="toogle-open"><span></span></label>

  <nav>
    <div>
      <a href="#"> <i class="fab fa-css3-alt"></i>offcanvas </a>
      <label for="toogle-menu" class="toogle-close">
        <span></span>
      </label>
    </div>
    <ul>
      <li><a href="#section1">Section </a></li>
      <li><a href="#section2">Section </a></li>
      <li><a href="#section3">Section </a></li>
      <li><a href="#section4">Section </a></li>
      <li><a href="#section5">Section </a></li>
    </ul>
  </nav>
</header>

<main>
  <section id="section1">
    šŸ¤˜ Pure CSS off canvas menu šŸ˜Ž
  </section>
  <section id="section2">
    Lorem ipsum dolor sit amet.
  </section>
  <section id="section3">
    Lorem ipsum dolor sit amet.
  </section>
  <section id="section3">
    Lorem ipsum dolor sit amet.
  </section>
  <section id="section4">
    Lorem ipsum dolor sit amet.
  </section>
  <section id="section5">
    Lorem ipsum dolor sit amet.
  </section>
</main>

<footer>
  &copy; 2020 | build with <span>šŸ’œ</span> by
  <a href="https://www.linkedin.com/in/saiefalemon">Saief Al Emon</a>
</footer>
@import url("https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Monoton&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 10px;
  scroll-behavior: smooth;
}

body {
  font-family: "Lato", sans-serif;
  font-size: 1.5rem;
  font-weight: 300;
  background: #16161a;
  color: #f3f3f3;
}

a {
  text-decoration: none;
  outline: none;
  color: darken($color: #fff, $amount: 80);
}

li {
  list-style: none;
}

@keyframes hover {
  50% {
    transform: translateX(10px);
  }
}

.offcanvas-menu {
  > label {
    top: 30px;
    left: 30px;
    position: fixed;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: 0.3s ease;
    display: flex;
    align-items: center;
    z-index: 9999;
  }
  label {
    span,
    span::before,
    span::after {
      transition: background 0.3s, transform 0.3s;
    }
    span,
    span::before,
    span::after {
      content: "";
      position: absolute;
      height: 4px;
      width: 40px;
      background: darken($color: #fff, $amount: 30);
    }
    span::before {
      transform: translateY(-12px);
    }
    span::after {
      transform: translateY(12px);
    }
  }
  nav {
    position: fixed;
    height: 100%;
    width: 350px;
    left: -350px;
    overflow: hidden;
    background: #bdddff;
    transition: 0.3s ease;
    padding: 40px 30px;

    > div {
      display: flex;
      justify-content: space-between;
      align-items: center;
      a {
        font-size: 2.5rem;
        font-weight: 500;
        display: flex;
        align-items: center;
        font-family: "Monoton", cursive;
        background: linear-gradient(-90deg, #49a4ed 30%, #3d00a9 110%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        i {
          font-size: 4rem;
          background: linear-gradient(120deg, #49a4ed 30%, #3d00a9 110%);
          -webkit-background-clip: text;
          -webkit-text-fill-color: transparent;
        }
      }
      label {
        width: 30px;
        height: 30px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: 0.3s ease;
        span,
        span:before,
        span:after {
          background: darken($color: #fff, $amount: 70);
        }
      }
    }
    > ul {
      margin-top: 30px;
      counter-reset: nav-link-count;

      li {
        cursor: pointer;
        padding: 10px 0;
        transform: translateX(-30px);
        opacity: 0;
        transition: 0.4s ease;
        counter-increment: nav-link-count;

        a {
          font-size: 2.5rem;
          line-height: 1.5;
          font-weight: 400;
          color: darken($color: #fff, $amount: 80);
          display: block;

          &::after {
            content: " : " counter(nav-link-count);
          }
        }

        &:hover {
          animation: hover 0.5s;
        }
      }
    }
  }

  input[type="checkbox"] {
    display: none;

    &:checked {
      ~ label {
        opacity: 0;
        pointer-events: none;
      }
      ~ nav {
        left: 0;
      }

      ~ nav label span {
        background: transparent;
      }
      ~ nav label span:before {
        transform: rotate(-45deg);
      }
      ~ nav label span:after {
        transform: rotate(45deg);
      }
      ~ nav label span:before,
      ~ nav label span:after {
        transition-delay: 0.2s;
      }

      ~ nav ul li {
        opacity: 1;
        transform: translateX(0px);
      }
      ~ nav ul li:nth-child(1) {
        transition-delay: 0.1s;
      }
      ~ nav ul li:nth-child(2) {
        transition-delay: 0.2s;
      }
      ~ nav ul li:nth-child(3) {
        transition-delay: 0.3s;
      }
      ~ nav ul li:nth-child(4) {
        transition-delay: 0.4s;
      }
      ~ nav ul li:nth-child(5) {
        transition-delay: 0.5s;
      }
      ~ nav ul li:nth-child(6) {
        transition-delay: 0.6s;
      }
      ~ nav ul li:nth-child(7) {
        transition-delay: 0.7s;
      }
    }
  }
}

section {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 80vh;
  font-size: 4rem;
  color: lighten($color: #000000, $amount: 70);

  &:nth-child(odd) {
    background: lighten($color: #0e0819, $amount: 2);
  }
  &:nth-child(even) {
    background: lighten($color: #0e0819, $amount: 4);
  }
}
footer {
  padding: 20px 0;
  text-align: center;
  font-size: 1.5rem;
  background: lighten($color: #0e0819, $amount: 2);
  color: lighten($color: #000000, $amount: 50);
  a {
    color: lighten($color: #000000, $amount: 60);
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://kit.fontawesome.com/263341f1b6.js