Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- MENU OVERLAY -->
<div class="overlay overlay-slide-left" id="overlay">
  <!-- MENU ITEMS -->
  <nav>
    <ul>
      <li id="nav-1" class="slide-out-1 center">
        <a href="#home" class="center">Home</a>
      </li>
      <li id="nav-2" class="slide-out-2 center">
        <a href="#about" class="center">About</a>
      </li>
      <li id="nav-3" class="slide-out-3 center">
        <a href="#skills" class="center">Skills</a>
      </li>
      <li id="nav-4" class="slide-out-4 center">
        <a href="#projects" class="center">Projects</a>
      </li>
      <li id="nav-5" class="slide-out-5 center">
        <a href="#contact" class="center">Contact</a>
      </li>
    </ul>
  </nav>
</div>
<!-- HAMBURGER MENU -->
<div class="hamburger-menu" id="hamburger-menu">
  <div class="menu-bar1"></div>
  <div class="menu-bar2"></div>
  <div class="menu-bar3"></div>
</div>
<!-- SECTIONS -->
<section id="home" class="center">
  <p class="logo">Krishandeep</p>
</section>
<section id="about" class="center">
  <h1>Know More Who I am</h1>
</section>
<section id="skills" class="center">
  <h1>Here's all the stuff I do</h1>
</section>
<section id="projects" class="center">
  <h1>Here's stuff I made recently</h1>
</section>
<section id="contact" class="center">
  <h1>Have me make stuff for you</h1>
</section>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Nunito&display=swap");

/***********************/
/* RESET CSS */
/***********************/

* {
  box-sizing: border-box;
  font-family: "Nunito", sans-serif;
  margin: 0;
  padding: 0;
}

html {
  /* 
    font-size: 10px; 
    10px / 16px = 0.625 = 62.5%
    Percentage of user's browser font-size setting
  */
  font-size: 62.5%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

a:link,
a:visited {
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  transition: all 0.3s;
}

/* HELPER CLASSES */
.center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/***********************/
/* NAVIGATION MENU */
/***********************/

/* OVERLAY */
.overlay {
  z-index: 9;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  background-color: rgba(0, 0, 0, 0.7);
}

.overlay-slide-right {
  transition: all 0.4s ease-in-out;
  transform: translateX(0);
}

.overlay-slide-left {
  transition: all 0.8s ease-in-out;
  transform: translateX(-100%);
}

/* NAV MENU ITEMS */
nav ul {
  height: 100vh;
  height: 100svh;
  list-style: none;
}

nav ul li {
  height: 20%;
}

nav li:nth-of-type(1) {
  background-color: #626059;
}

nav li:nth-of-type(2) {
  background-color: #9d5543;
}

nav li:nth-of-type(3) {
  background-color: #3d405b;
}

nav li:nth-of-type(4) {
  background-color: #5a7d6c;
}

nav li:nth-of-type(5) {
  background-color: #917a56;
}

nav li a {
  letter-spacing: 0.4rem;
  font-size: 2rem;
}

nav li a:hover,
nav li a:active {
  transform: scale(1.2);
}

/***********************/
/* NAV SLIDE IN ANIMATION */
/***********************/

.slide-in-1 {
  animation: slide-in 0.4s linear 0.2s both;
}

.slide-in-2 {
  animation: slide-in 0.4s linear 0.4s both;
}

.slide-in-3 {
  animation: slide-in 0.4s linear 0.6s both;
}

.slide-in-4 {
  animation: slide-in 0.4s linear 0.8s both;
}

.slide-in-5 {
  animation: slide-in 0.4s linear 1s both;
}

@keyframes slide-in {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/***********************/
/* NAV SLIDE OUT ANIMATION */
/***********************/

.slide-out-1 {
  animation: slide-out 0.3s linear 0.5s both;
}

.slide-out-2 {
  animation: slide-out 0.3s linear 0.4s both;
}

.slide-out-3 {
  animation: slide-out 0.3s linear 0.3s both;
}

.slide-out-4 {
  animation: slide-out 0.3s linear 0.2s both;
}

.slide-out-5 {
  animation: slide-out 0.3s linear 0.1s both;
}

@keyframes slide-out {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

/***********************/
/* HAMBURGER MENU ANIMATION */
/***********************/

.hamburger-menu {
  position: fixed;
  top: 1rem;
  right: 2rem;
  z-index: 10;
  cursor: pointer;
}

.menu-bar1,
.menu-bar2,
.menu-bar3 {
  width: 3.5rem;
  height: 0.2rem;
  background-color: #fff;
  margin: 0.8rem 0;
  transition: 0.4s;
}

.menu-bar2 {
  width: 2rem;
  margin-left: auto;
}

/* ROTATE FIRST BAR */
.active .menu-bar1 {
  transform: rotate(-45deg) translate(-0.7rem, 0.8rem);
}

/* FADE OUT SECOND BAR */
.active .menu-bar2 {
  opacity: 0;
}

/* ROTATE LAST BAR */
.active .menu-bar3 {
  transform: rotate(45deg) translate(-0.6rem, -0.8rem);
}

/***********************/
/* SECTION */
/***********************/

section {
  width: 100%;
  height: 100vh;
  height: 100svh;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  text-align: center;
  color: #fff;
}

.logo {
  position: fixed;
  z-index: 2;
  top: 1.5rem;
  left: 1.5rem;
  font-size: 1.4rem;
  letter-spacing: 0.3rem;
}

h1 {
  font-size: 3rem;
  background-color: rgb(0, 0, 0, 0.6);
  padding: 0.5rem 1rem;
}

section#home {
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
    url("https://images.unsplash.com/photo-1473172707857-f9e276582ab6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80")
      no-repeat center center / cover;
}

section#about {
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
    url("https://images.unsplash.com/photo-1543269664-647163ef2ee4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80")
      no-repeat center center / cover;
}

section#skills {
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
    url("https://images.unsplash.com/photo-1522202176988-66273c2fd55f?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2071&q=80")
      no-repeat center center / cover;
}

section#projects {
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
    url("https://images.unsplash.com/photo-1432888498266-38ffec3eaf0a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2074&q=80")
      no-repeat center center / cover;
}

section#contact {
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
    url("https://images.unsplash.com/photo-1497032628192-86f99bcd76bc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80")
      no-repeat center center / cover;
}

/**************************/
/* MEDIA QUERY */
/**************************/

/* BELOW 832px (Tablets) */
@media (max-width: 52em) {
  html {
    /* 8px / 16px = 0.5 = 50% */
    font-size: 50%;
  }
}

/* BELOW 600px (Phones) */
@media (max-width: 37em) {
  .hamburger-menu {
    top: 0.5rem;
    right: 1rem;
  }
  .logo {
    top: 1rem;
    left: 1rem;
  }
  h1 {
    font-size: 2rem;
  }
}

              
            
!

JS

              
                const hamburgerMenu = document.querySelector("#hamburger-menu");
const overlay = document.querySelector("#overlay");
const nav1 = document.querySelector("#nav-1");
const nav2 = document.querySelector("#nav-2");
const nav3 = document.querySelector("#nav-3");
const nav4 = document.querySelector("#nav-4");
const nav5 = document.querySelector("#nav-5");
const navItems = [nav1, nav2, nav3, nav4, nav5];

// Control Navigation Animation
function navAnimation(val1, val2) {
  navItems.forEach((nav, i) => {
    nav.classList.replace(`slide-${val1}-${i + 1}`, `slide-${val2}-${i + 1}`);
  });
}

function toggleNav() {
  // Toggle: Hamburger Open/Close
  hamburgerMenu.classList.toggle("active");

  //   Toggle: Menu Active
  overlay.classList.toggle("overlay-active");

  if (overlay.classList.contains("overlay-active")) {
    // Animate In - Overlay
    overlay.classList.replace("overlay-slide-left", "overlay-slide-right");

    // Animate In - Nav Items
    navAnimation("out", "in");
  } else {
    // Animate Out - Overlay
    overlay.classList.replace("overlay-slide-right", "overlay-slide-left");

    // Animate Out - Nav Items
    navAnimation("in", "out");
  }
}

// Events Listeners
hamburgerMenu.addEventListener("click", toggleNav);
navItems.forEach((nav) => {
  nav.addEventListener("click", toggleNav);
});

              
            
!
999px

Console