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

              
                <main role="main">
  <article>
    <h1>Nav/Menu Button</h1>
    <h3>flexbox, SVG icons, :checked, No JS</h3>
    
    <p>Oh and just for fun the menu scales with page width. Icons are from <a href="https://github.com/google/material-design-icons">Material Design Icons</a>.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quo, commodi nulla sunt aperiam qui eius non officia aliquid aspernatur totam mollitia doloribus assumenda reprehenderit tempora distinctio alias unde voluptate placeat. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio, porro fugit modi voluptatibus amet sint optio. Perferendis, ratione, facilis, ex ipsum quaerat possimus mollitia esse eaque quae eveniet excepturi laudantium.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sint, dolor, accusamus, cupiditate eos quas dignissimos esse tempora nisi iusto fuga sed atque doloremque dolore odio nam laudantium debitis ea officiis?</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorum, inventore, in deserunt at vitae quidem autem sed mollitia recusandae quaerat ad quibusdam neque nesciunt amet facilis nostrum magnam ab consequatur? Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore, vitae ducimus vel ad totam maiores veniam. Rem, libero, in, numquam veritatis consequatur officia nobis laboriosam doloribus assumenda quaerat mollitia animi. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Et, incidunt, praesentium, dolorem totam aspernatur illum veritatis unde officiis aliquam quam asperiores hic quae cum eum velit sint minus cumque perferendis.</p>
  </article>
</main>

<nav>
  <input type="checkbox" id="start">
  <label for="start" class="toggle">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
      <use xlink:href="#symbol-apps" x="0" y="0" />
    </svg>
  </label>

  <ul>
    <li>
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
        <use xlink:href="#symbol-alarm" x="0" y="0" />
      </svg>        
      Alarm
    </li>
    <li>
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
        <use xlink:href="#symbol-print" x="0" y="0" />
      </svg>
      Print
    </li>
    <li>
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
        <use xlink:href="#symbol-cart" x="0" y="0" />
      </svg>
      Cart
    </li>
    <li>
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
        <use xlink:href="#symbol-stars" x="0" y="0" />
      </svg>
      Stars
    </li>
    <li>
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
        <use xlink:href="#symbol-share" x="0" y="0" />
      </svg>
      Share
    </li>
    <li>
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
        <use xlink:href="#symbol-alarm" x="0" y="0" />
      </svg>        
      Alarm
    </li>
    <li>
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
        <use xlink:href="#symbol-print" x="0" y="0" />
      </svg>
      Print
    </li>
    <li>
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
        <use xlink:href="#symbol-cart" x="0" y="0" />
      </svg>
      Cart
    </li>
    <li>
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
        <use xlink:href="#symbol-stars" x="0" y="0" />
      </svg>
      Stars
    </li>
    <li>
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
        <use xlink:href="#symbol-share" x="0" y="0" />
      </svg>
      Share
    </li>
  </ul>
</nav>

<svg style="display: none;">
  <defs>
    <symbol id="symbol-alarm">
      <title>Alarm</title>
      <path d="M44 11.44l-9.19-7.71-2.57 3.06 9.19 7.71 2.57-3.06zm-28.24-4.66l-2.57-3.06-9.19 7.71 2.57 3.06 9.19-7.71zm9.24 9.22h-3v12l9.49 5.71 1.51-2.47-8-4.74v-10.5zm-1.01-8c-9.95 0-17.99 8.06-17.99 18s8.04 18 17.99 18 18.01-8.06 18.01-18-8.06-18-18.01-18zm.01 32c-7.73 0-14-6.27-14-14s6.27-14 14-14 14 6.27 14 14-6.26 14-14 14z" />
    </symbol>
    <symbol id="symbol-cart">
      <title>Shopping Cart</title>
      <path d="M14 36c-2.21 0-3.98 1.79-3.98 4s1.77 4 3.98 4 4-1.79 4-4-1.79-4-4-4zm-12-32v4h4l7.19 15.17-2.7 4.9c-.31.58-.49 1.23-.49 1.93 0 2.21 1.79 4 4 4h24v-4h-23.15c-.28 0-.5-.22-.5-.5 0-.09.02-.17.06-.24l1.79-3.26h14.9c1.5 0 2.81-.83 3.5-2.06l7.15-12.98c.16-.28.25-.61.25-.96 0-1.11-.9-2-2-2h-29.57l-1.9-4h-6.53zm32 32c-2.21 0-3.98 1.79-3.98 4s1.77 4 3.98 4 4-1.79 4-4-1.79-4-4-4z" />
    </symbol>
    <symbol id="symbol-stars">
      <title>Stars</title>
      <path d="M23.99 4c-11.05 0-19.99 8.95-19.99 20s8.94 20 19.99 20c11.05 0 20.01-8.95 20.01-20s-8.96-20-20.01-20zm8.47 32l-8.46-5.1-8.46 5.1 2.24-9.62-7.46-6.47 9.84-.84 3.84-9.07 3.84 9.07 9.84.84-7.46 6.47 2.24 9.62z" />
    </symbol>
    <symbol id="symbol-print">
      <title>Print</title>
      <path d="M38 16h-28c-3.31 0-6 2.69-6 6v12h8v8h24v-8h8v-12c0-3.31-2.69-6-6-6zm-6 22h-16v-10h16v10zm6-14c-1.11 0-2-.89-2-2s.89-2 2-2c1.11 0 2 .89 2 2s-.89 2-2 2zm-2-18h-24v8h24v-8z" />
    </symbol>
    <symbol id="symbol-apps">
      <title>Apps</title>
      <path d="M8 16h8V8H8v8zm12 24h8v-8h-8v8zM8 40h8v-8H8v8zm0-12h8v-8H8v8zm12 0h8v-8h-8v8zM32 8v8h8V8h-8zm-12 8h8V8h-8v8zm12 12h8v-8h-8v8zm0 12h8v-8h-8v8z" />
    </symbol>
    <symbol id="symbol-share">
      <title>Share</title>
      <path d="M36 32.17c-1.52 0-2.89.59-3.93 1.54L17.82 25.4c.11-.45.18-.92.18-1.4s-.07-.95-.18-1.4l14.1-8.23c1.07 1 2.5 1.62 4.08 1.62 3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6c0 .48.07.95.18 1.4l-14.1 8.23c-1.07-1-2.5-1.62-4.08-1.62-3.31 0-6 2.69-6 6s2.69 6 6 6c1.58 0 3.01-.62 4.08-1.62l14.25 8.31c-.1.42-.16.86-.16 1.31 0 3.22 2.61 5.83 5.83 5.83s5.83-2.61 5.83-5.83-2.61-5.83-5.83-5.83z" />
    </symbol>
  </defs>
</svg>
              
            
!

CSS

              
                *, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
}
html {
  font-family: Open Sans, sans-serif;
  box-sizing: border-box;
}
body {
  background-color: hsl(210, 15%, 10%);
  background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0OCA0OCI+DQo8ZyBzdHlsZT0iZmlsbDogaHNsYSgwLCAwJSwgMTAwJSwgMC4wMik7IHN0cm9rZTogaHNsYSgwLCAwJSwgMTAwJSwgMC4wMik7IHN0cm9rZS13aWR0aDogMC4xOyI+DQo8cGF0aCBkPSJtNyA0bDE2IDV2NGwtMTMtNGMwIDAtMiAzLTIgNyAwIDQgMiA3IDIgN2wxMC0yLTEtNCA0LTJ2MTZoLTRsMS03LTEzIDNjMCAwLTMtNy0zLTExIDAtNCAzLTEyIDMtMTIiLz4NCjxwYXRoIGQ9Im00MSA0bC0xNiA1djRsMTMtNGMwIDAgMiAzIDIgNyAwIDQtMiA3LTIgN2wtMTAtMiAxLTQtNC0ydjE2aDRsLTEtNyAxMyAzYzAgMCAzLTcgMy0xMSAwLTQtMy0xMi0zLTEyIi8+DQo8cGF0aCBkPSJtMTMgMzNoNHYxMWMwIDAtNC00LTQtNyAwLTMgMC00IDAtNCIvPg0KPHBhdGggZD0ibTMxIDMzaDRjMCAwIDAgMSAwIDQgMCAzLTQgNy00IDd6Ii8+DQo8cGF0aCBkPSJtMTkgMzNoNHY0aC00eiIvPg0KPHBhdGggZD0ibTI1IDMzaDR2NGgtNHoiLz4NCjwvZz4NCjwvc3ZnPg0K);
  background-size: cover;
  background-repeat: no-repeat;
  color: hsl(0, 0%, 80%);
  max-width: 50em;
  margin: 0 auto;
}
nav {
  position: fixed;
  padding: 0.25vw;
  right: 0;
  top: 5vw;
  display: flex;
  flex-flow: column;
  font-size: 0;
  font-family: Open Sans, sans-serif;
  touch-action: none;
}
nav > input {
  display: none;
}
nav > .toggle {
  margin-left: auto;
  fill: hsl(210, 35%, 35%);
  width: 5vw;
  height: 5vw;
  background-color: hsla(0, 0%, 100%, 0.85);
  border-radius: 0.5vw;
}
nav > ul {
  display: flex;
  width: auto;
  flex-flow: row wrap;
  justify-content: space-around;
  align-items: center;
  max-width: 23vw;
  list-style: none;
  padding: 0.25vw;
  background-color: hsla(0, 0%, 100%, 0.85);
  border-radius: 0.5vw 0 0.5vw 0.5vw;
}
nav > ul > li {
  font-size: 1.1vw;
  line-height: 1;
  text-align: center;
  flex: auto;
  width: 4.5vw;
  max-width: 4.5vw;
  height: 6vw;
  padding: 0.5vw;
  border-radius: 0.5vw;
  color: hsl(210, 35%, 35%);
  fill: hsl(210, 35%, 35%);
}
nav > ul > li > svg {
  height: 3.5vw;
}
nav > ul > li:hover {
  background-color: hsla(0, 0%, 0%, 0.8);
  fill: hsl(210, 35%, 70%);
  color: hsl(210, 35%, 70%);
}
input#start ~ ul {
  display: none;
}
input#start:checked ~ ul {
  display: flex;
}
input#start:checked ~ .toggle {
  border-radius: 0.5vw 0.5vw 0vw 0vw ;
}
input#start:checked ~ .toggle > svg {
  transform: scale(0.25);
  stroke: hsl(210, 35%, 35%);
  stroke-width: 5;
}
article {
  text-align: justify;
  margin: 1rem;
}
h1 {
  text-align: center;
  font-size: 2em;
  line-height: 1.8;
}
h3 {
  text-align: center;
}
p + p {
  margin-top: 1rem;
}
a {
  color: inherit;
  text-decoration: none;
  border-bottom: 2px dotted yellow;
}
              
            
!

JS

              
                // Nothing to see here.
              
            
!
999px

Console