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

              
                <section id="main">
      <!--Navigation-->
      <nav>
        <div class="logo">
          <a href="#">LOGO</a>
        </div>
        <input class="menu-btn" type="checkbox" id="menu-btn" />
        <label class="menu-icon" for="menu-btn">
          <span class="nav-icon"></span>
        </label>
        <!--Navigation-->
        <ul class="menu">
          <li><a href="#main">Home</a></li>
          <li><a href="#services">Services</a></li>
          <li><a href="#about">About</a></li>
          <li><a href="#contact">Contact</a></li>
        </ul>
      </nav>
  
      <div class="content">
        <h1>User Preferences</h1>
      <p>prefers-color-scheme</p>
      </div>
  
    </section>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins";
}
:root {
  --bg-color: repeating-linear-gradient(
    45deg,
    #876a9e,
    #876a9e 50px,
    #b393d3 50px,
    #b393d3 100px,
    #a288b2 100px,
    #a288b2 150px
  );
  --nav-content-bg: rgba(255, 255, 255, 0.1);
  --text-color: #301934;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: repeating-linear-gradient(
      45deg,
      #553c9a,
      #553c9a 50px,
      #3a1e4f 50px,
      #3a1e4f 100px,
      #301934 100px,
      #301934 150px
    );
    --nav-content-bg: rgba(0, 0, 0, 0.5);
    --text-color: #b393d3;
  }
}

ul {
  list-style: none;
}
a {
  text-decoration: none;
}
nav {
  position: fixed;
  width: 100%;
  display: inline-flex;
  justify-content: space-around;
  align-items: center;
  height: 60px;
  padding: 0px 5%;
  z-index: 1;
  backdrop-filter: blur(5px);
  background-color: var(--nav-content-bg);
}
.logo a {
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.5px;
  color: var(--text-color);
}
nav ul {
  display: flex;
}
nav ul li a {
  height: 40px;
  line-height: 43px;
  margin: 10px;
  padding: 0px 30px;
  display: flex;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
  transition: 0.1s;
}
#main {
  width: 100%;
  min-height: 100vh;
  position: relative;
  background-image: var(--bg-color);
  background-size: cover;
  background-attachment: fixed;
}
.content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 70%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-direction: column;
  border-radius: 5px;
  backdrop-filter: blur(5px);
  background-color: var(--nav-content-bg);
}
.content h1 {
  font-size: 3rem;
  font-weight: 600;
  color: var(--text-color);
}
.content p {
  font-size: 2rem;
  color: var(--text-color);
}
nav .menu-btn {
  display: none;
}


@media (max-width: 900px) {
  nav {
    justify-content: space-between;
    height: 65px;
    padding: 0px 30px;
  }
  .logo img {
    height: 35px;
  }
  .menu {
    display: none;
    position: absolute;
    top: 65px;
    left: 0px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    padding: 0px;
    margin: 0px;
  }
  .menu li {
    width: 100%;
  }
  nav .menu li a {
    width: 100%;
    height: 40px;
    justify-content: center;
    align-items: center;
    margin: 0px;
    padding: 25px;
    border: 1px solid rgba(38, 38, 38, 0.03);
  }
  nav .menu-icon {
    cursor: pointer;
    float: right;
    padding: 28px 20px;
    position: relative;
    user-select: none;
  }
  nav .menu-icon .nav-icon {
    display: block;
    height: 2px;
    position: relative;
    transition: background 0.2s ease-out;
    width: 18px;
  }
  nav .menu-icon .nav-icon::before,
  nav .menu-icon .nav-icon::after {
    content: "";
    display: block;
    height: 100%;
    position: absolute;
    transition: all ease-out 0.2s;
    width: 100%;
  }
  nav .menu-icon .nav-icon:before {
    top: 5px;
  }
  nav .menu-icon,
  .nav-icon:after {
    top: -5px;
  }
  nav .menu-btn:checked ~ .menu-icon .nav-icon {
    background: transparent;
  }
  nav .menu-btn:checked ~ .menu-icon .nav-icon:before {
    transform: rotate(-45deg);
    top: 0;
  }
  nav .menu-btn:checked ~ .menu-icon .nav-icon:after {
    transform: rotate(45deg);
    top: 0;
  }
  nav .menu-btn {
    display: none;
  }
  nav .menu-btn:checked ~ .menu {
    display: block;
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console