Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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

Save Automatically?

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

              
                <header class="header">
  <a class="header__logo" href="#">
    <span class="logo__title">John Doe</span>
    <img class="logo__image" src="https://i.imgur.com/Q4LtrpQ.png" alt="John Doe">
  </a>
  <nav class="header__nav">
    <ul class="header__list">
      <li><a class="header__link" href="#">Home</a></li>
      <li><a class="header__link" href="#">About</a></li>
      <li><a class="header__link" href="#">Contact</a></li>
    </ul>
  </nav>
  <div class="burger">
    <svg width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
      <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g id="ic_fluent_navigation_24_regular" fill="#ffffff" fill-rule="nonzero">
          <path d="M2.75254822,18 L21.2525482,18 C21.6667618,18 22.0025482,18.3357864 22.0025482,18.75 C22.0025482,19.1296958 21.7203943,19.443491 21.3543188,19.4931534 L21.2525482,19.5 L2.75254822,19.5 C2.33833466,19.5 2.00254822,19.1642136 2.00254822,18.75 C2.00254822,18.3703042 2.2847021,18.056509 2.65077766,18.0068466 L2.75254822,18 L21.2525482,18 L2.75254822,18 Z M2.75254822,11.5030063 L21.2525482,11.5030063 C21.6667618,11.5030063 22.0025482,11.8387927 22.0025482,12.2530063 C22.0025482,12.6327021 21.7203943,12.9464972 21.3543188,12.9961597 L21.2525482,13.0030063 L2.75254822,13.0030063 C2.33833466,13.0030063 2.00254822,12.6672199 2.00254822,12.2530063 C2.00254822,11.8733105 2.2847021,11.5595153 2.65077766,11.5098529 L2.75254822,11.5030063 L21.2525482,11.5030063 L2.75254822,11.5030063 Z M2.75168905,5.0032392 L21.251689,5.0032392 C21.6659026,5.0032392 22.001689,5.33902564 22.001689,5.7532392 C22.001689,6.13293497 21.7195352,6.44673016 21.3534596,6.49639258 L21.251689,6.5032392 L2.75168905,6.5032392 C2.33747549,6.5032392 2.00168905,6.16745276 2.00168905,5.7532392 C2.00168905,5.37354343 2.28384293,5.05974824 2.64991849,5.01008582 L2.75168905,5.0032392 L21.251689,5.0032392 L2.75168905,5.0032392 Z" id="🎨-Color"></path>
        </g>
      </g>
    </svg>
  </div>
</header>
<nav class="mobile-nav hidden">
  <ul class="mobile-nav__list">
    <li><a class="mobile-nav__link" href="#">Home</a></li>
    <li><a class="mobile-nav__link" href="#">About</a></li>
    <li><a class="mobile-nav__link" href="#">Contact</a></li>
  </ul>
  <div class="mobile-nav__close">
    <svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" x="0px" y="0px" viewBox="0 0 490 490" style="enable-background:new 0 0 490 490;" xml:space="preserve">
      <polygon fill="#ffffff" points="456.851,0 245,212.564 33.149,0 0.708,32.337 212.669,245.004 0.708,457.678 33.149,490 245,277.443 456.851,490 489.292,457.678 277.331,245.004 489.292,32.337 "/>
    </svg>
  </div>
</nav>

              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,700;1,400&display=swap');


:root {
    --header-height: 50px;
    --header-background: #2c2c2c;
    --header-hover: #414141;
}

* {
    box-sizing: border-box;
    list-style: none;
    margin: 0;
    padding: 0;
    text-decoration: none;
    text-transform: none;
}

html, body {
    min-height: 100vh;
    height: 100%;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
}

.header {
    display: flex;
    width: 100%;
    padding: 0 10px;
    height: var(--header-height);
    background: var(--header-background);
}

.header__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    color: white;
    font-weight: bold;
    font-size: 1.3rem;
}

.logo__image {
    width: var(--header-height);
    padding: 10px;
}

.header__nav {
    display: flex;
}

.header__list {
    display: flex;
}

.header__link {
    display: flex;
    align-items: center;
    padding: 0 10px;
    height: var(--header-height);
    color: white;
}

.header__link:hover {
    background: var(--header-hover);
}

.burger {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
    cursor: pointer;
    margin-left: auto;
}

.mobile-nav {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--header-background);
    transition: display 0.3s;
}

.mobile-nav__list {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.mobile-nav__link {
    display: flex;
    justify-content: center;
    padding: 10px 0;
    color: white;
    font-weight: bold;
}

.mobile-nav__close {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #212121;
    height: var(--header-height);
    cursor: pointer;
}

/* tablet */
@media (max-width: 768px) {
    .header__nav { display: none; }
    .header { position: fixed; bottom: 0; left: 0; }
}

/* desktop */
@media (min-width: 769px) {
    .burger { display: none; }
}

.hidden {
    display: none;
}
              
            
!

JS

              
                const burger = document.querySelector('.burger');
const mobileNavClose = document.querySelector('.mobile-nav__close');
const mobileNav = document.querySelector('.mobile-nav');

burger.addEventListener('click', (e) => {
    mobileNav.classList.toggle('hidden');
});
mobileNavClose.addEventListener('click', (e) => {
    mobileNav.classList.toggle('hidden');
});

              
            
!
999px

Console