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

              
                <!-- Mobile Bar & Menu Icon -->
<input type="checkbox" class="menu-toggle" id="menu-toggle">
<div class="mobile-bar">
  <label for="menu-toggle" class="menu-icon">
	  <span></span>
	</label>
</div>

<!-- Header -->
<header class="header">
  <nav>
    <ul>
      <li><a href="#">Item 1</a></li>
      <li><a href="#">Item 2</a></li>
      <li><a href="#">Item 3</a></li>
      <li><a href="#">Item 4</a></li>
      <li><a href="#">Item 5</a></li>
    </ul>
  </nav>
</header>

<!-- Container -->
<div class="container">

  <!-- Content -->
  <section class="content">
    <h1>Menu Off-Canvas (Pure CSS)</h1>
    <p>Change the Media Query around line 200 in the CSS to change when the menu expands.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis quasi soluta sint dolor, modi consectetur repudiandae provident voluptatem illum ipsum!</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis quasi soluta sint dolor, modi consectetur repudiandae provident voluptatem illum ipsum!</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis quasi soluta sint dolor, modi consectetur repudiandae provident voluptatem illum ipsum!</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis quasi soluta sint dolor, modi consectetur repudiandae provident voluptatem illum ipsum!</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis quasi soluta sint dolor, modi consectetur repudiandae provident voluptatem illum ipsum!</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis quasi soluta sint dolor, modi consectetur repudiandae provident voluptatem illum ipsum!</p>
  </section>

  <!-- Footer -->
  <footer class="footer">
    <p>Developed by <a href="https://github.com/kaiquezimerer" target="_blank">Kaíque Zimerer</a></p>
  </footer>
</div>
              
            
!

CSS

              
                /**---- Base ----**/

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

html,
body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

body {
  background-color: #eee;
  font-family: "Open Sans", sans-serif;
  font-size: 100%;
  color: #333;
}

ol,
ul {
  list-style: none;
}

a {
  text-decoration: none;
  color: inherit;
}

h1 {
   margin: 1em 0;
}

p {
  margin: 0.9em 0;
  line-height: 1.5;
}

::selection {
  background-color: #333;
  color: #eee;
}

/**---- Mobile Bar ----**/

.menu-toggle {
  display: none;
}

.mobile-bar {
  z-index: 10;
  position: fixed;
  top: 0;
  left: 0;
  padding: 0 25px;
  width: 100%;
  height: 60px;
  background-color: #333;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

/**---- Menu Icon ----**/

.menu-icon {
  display: block;
  position: relative;
  width: 25px;
  height: 100%;
  cursor: pointer;
  transition: transform 300ms ease;
}

.menu-icon > span {
  display: block;
  position: absolute;
  top: 55%;
  margin-top: -0.3em;
  width: 100%;
  height: 0.3em;
  border-radius: 1px;
  background-color: #eee;
  transition: transform 300ms ease;
}

.menu-icon > span:before,
.menu-icon > span:after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 1px;
  background-color: #eee;
  transition: transform 300ms ease;
}

.menu-icon > span:before {
  transform: translateY(-0.6em);
}

.menu-icon > span:after {
  transform: translateY(0.6em);
}

/**---- Menu Icon Effects ----**/

.menu-toggle:checked + .mobile-bar .menu-icon {
  transform: rotate(45deg);
}

.menu-toggle:checked + .mobile-bar span:before,
.menu-toggle:checked + .mobile-bar span:after {
  transform: rotate(90deg);
}

/**---- Off-Canvas Effect ----**/

.menu-toggle:checked ~ .header {
  transform: translateX(50%);
  transform: translate3d(50%, 0, 0);
}

.menu-toggle:checked ~ .container {
  transform: translateX(70%);
  transform: translate3d(70%, 0, 0);
}

/**---- Header ----**/

.header {
  position: fixed;
  top: 0;
  left: -35%;
  padding-top: 60px;
  width: 70%;
  height: 100%;
  background-color: #333;
  overflow-y: scroll;
  text-align: center;
  color: #eee;
  transition: transform 300ms ease;
}

.header nav,
.header ul {
  height: 100%;
}

.header li {
  border-bottom: 1px solid #eee;
}

.header a {
  display: block;
  padding: 20px;
  transition: background-color 300ms ease;
}

.header a:hover {
  background-color: #222;
}

/**---- Container ----**/

.container {
  position: relative;
  top: 60px;
  padding: 20px;
  background-color: #eee;
  transition: transform 300ms ease;
}

/**---- Content ----**/

.content {
  margin: 0 auto;
  max-width: 720px;
}

/**---- Footer ----**/

.footer {
  margin-top: 40px;
  font-size: 0.9em;
  text-align: center;
}

.footer a {
  font-weight: 700;
}

.footer a:hover {
  text-decoration: underline;
}

/**---- Viewport >= 720px ----**/

@media (min-width: 720px) {
  .menu-toggle:checked ~ .header {
    transform: translateX(0);
    transform: translate3d(0, 0, 0);
  }

  .menu-toggle:checked ~ .container {
    transform: translateX(0);
    transform: translate3d(0, 0, 0);
  }

  .mobile-bar {
    display: none;
  }

  .header {
    z-index: 5;
    position: relative;
    left: 0;
    padding-top: 0;
    width: 100%;
    height: auto;
    overflow: auto;
  }

  .header li {
    display: inline-block;
    margin-right: -6px; /* fix the inline-block gap */
    border: none;
  }

  .header a {
    padding: 12px 45px;
  }

  .container {
    top: 0;
  }
}

.content{
  display:grid;
  grid-template-columns:1fr 1fr;
  grid-gap:1em;
}
h1{
  grid-column:span 2;
}

              
            
!

JS

              
                /**
  Menu Off-Canvas (Pure CSS)
  A simple responsive navigation menu with a off-canvas effect developed with pure CSS.
**/

              
            
!
999px

Console