Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <html>
<head>
  <title>Mobile first navigation menu</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="style.css">
</head>
<body>

  <input type="checkbox" id="show-menu">
  
  <div id="fix-bar">
    <div class="logo">
      <a href="/">logo</a>
    </div>
    
    <div class="push">
      <label class="hamburguer" for="show-menu">
        <span></span>
        <span></span>
        <span></span>
        <span></span>
      </label>
    </div>
  </div>

  <div id="canvas">
    
    <div id="nav">
      <ul class="site-menu">    
        <li><a href="#/work">Work</a></li>
        <li class="has-sub"><a href="#/about">About</a></li>
        <li><a href="#/careers">Careers</a></li>
        <li><a href="#/ideas">Ideas</a></li>
        <li><a href="#/news">News</a></li>
        <li><a href="#/events">Events</a></li>
        <li><a href="#/contact">Contact</a></li>
        <li class="copy">© 2016 Logo. All Rights Reserved.</li>
      </ul>
    </div>

    <label for="show-menu" class="mask"></label>

    <div id="content">
      <h1>Lorem ipsum dolor sit amet</h1>

      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. In ut rerum voluptatum, expedita, ab perspiciatis nulla omnis veritatis, dignissimos explicabo officia neque eos. Itaque, reiciendis corrupti quos. Ipsa, non, itaque!</p>
      <p>Illum minima praesentium reiciendis iure voluptatem, maxime accusamus temporibus, quisquam nihil nostrum placeat, repudiandae facere. Nihil odio quia omnis iure temporibus. Ullam itaque consequatur eveniet voluptatem nam, suscipit nesciunt iste!</p>
      <p>Est eum delectus officia. Sequi hic reiciendis est ullam aliquid rem voluptates deserunt! Accusamus, consequuntur! Delectus distinctio doloremque possimus provident qui rerum id. Molestiae, impedit, porro nisi repellat atque esse.</p>
      <p>At possimus commodi dolorum hic dicta unde ipsam sequi laborum! Dignissimos tempora facere dolore ipsam eligendi repudiandae, ipsa placeat doloribus cumque quod dolores ab, ea labore incidunt ex sapiente! Possimus.</p>
      <p>Maxime beatae quia similique error quod cumque dicta facere, consequuntur quos? Alias ducimus aliquam commodi quis veritatis, beatae libero iure culpa id reiciendis ratione. Dolorum voluptatibus iusto id accusantium adipisci.</p>
      <p>Accusantium molestias velit ut voluptate adipisci sit possimus id. Consequuntur debitis suscipit ducimus nemo officia dolor voluptates saepe doloribus corporis dolorem autem, quasi, tempore maxime sapiente deleniti rem, a. Nesciunt.</p>
      <p>Nemo animi vitae fuga repellendus sequi, laborum voluptates molestias quo reprehenderit tenetur libero non quis deserunt veritatis culpa tempora a, voluptatem itaque. Totam atque id, praesentium corporis eaque dignissimos sed.</p>
      <p>Pariatur omnis expedita voluptates, aut laborum consequatur repudiandae aperiam, delectus voluptate, saepe ea magnam distinctio dolorum a reiciendis suscipit. Corporis ex animi reiciendis vero natus porro, tenetur dignissimos blanditiis quis?</p>
      <p>Adipisci dicta vitae, totam quisquam, aliquam sint non qui hic est beatae architecto laboriosam in. Sed at, pariatur doloremque libero facere voluptates culpa dolore. Quo debitis similique culpa quis fuga?</p>
      <p>Non ipsum porro perferendis pariatur, harum iusto amet dolore quasi aut quidem quod laboriosam libero odit accusamus animi, cumque ea commodi corporis, sequi eaque numquam aliquam! Consequuntur, animi dolorum debitis?</p>
    </div>
  
  </div>

</body>
</html>

            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Montserrat:700)

$nav-width = 250px
$magenta   = #00a8eb
$timing    = 0.5s
$ease      = ease

* 
  margin 0
  padding 0
  box-sizing border-box

html
body
  height 100%

body
  font-family 'Helvetica Neue', Helvetica, sans-serif

#fix-bar
  position fixed
  top 0
  left 0
  z-index 9
  width 100%
  height 60px
  background-color $magenta
  
  .logo
    position absolute
    left 0
    width $nav-width
    transform translate3d(-50%, 0, 0)
    transition transform $timing $ease
    
    a
      display block
      color #fff
      text-decoration none
      text-transform uppercase
      line-height 24px
      width 60px
      height 24px
      padding 18px 16px 18px 24px
      box-sizing content-box
    
  .push
    position relative
    left 0
    height 100%
    background-color $magenta
    transition transform $timing $ease
    
.hamburguer
  width 72px
  height 60px
  display block
  position relative
  cursor pointer
  
  span
    display block
    position absolute
    height 4px
    width 24px
    background #fff
    opacity 1
    left 24px
    transform rotate(0deg)
    transition .3s ease-in-out
    
    &:nth-child(1)
      top 20px

    &:nth-child(2)
    &:nth-child(3)
      top 28px

    &:nth-child(4)
      top 36px

#canvas
  position relative
  height 100%
  padding-top 60px
  overflow hidden

#nav
  overflow-y scroll
  position absolute
  left 0
  height 100%
  width $nav-width
  transform translate3d(-50%, 0, 0)
  transition transform $timing $ease
  padding-top 12px
  padding-bottom 60px // fix bar
  
  a
    text-decoration none
    color #000
    display block
    padding 14px 24px
    font 20px/1 'Montserrat', sans-serif
    font-weight 700
    
    &:hover
      background-color #eee
  
  .site-menu
    position relative
    min-height 100%
    padding-bottom 60px // copy height

  .copy
    position absolute
    bottom 0
    padding 16px 24px
    font-size 12px
    line-height 1.4

#content
  background-color #fff
  overflow-y scroll
  position relative
  left 0
  height 100%
  transition transform $timing $ease
  transform translate3d(0, 0, 0)
  padding 20px

.mask
  position absolute
  top 60px
  left 0
  z-index -1
  width 100%
  height 100%
  opacity 0
  transition opacity $timing $ease, transform $timing $ease, z-index 0s $timing
  background-color rgba(0, 0, 0, 0.5)

// trigger menu
input#show-menu
  position absolute
  opacity 0

// show mobile nav  
input#show-menu:checked ~ 
  
  #fix-bar
    
    .push
      transform translate3d($nav-width, 0, 0)
      
    .hamburguer span
      &:nth-child(1)
      &:nth-child(4)
        top 28px
        width 0
        left 50%

      &:nth-child(2)
        transform rotate(45deg)

      &:nth-child(3)
        transform rotate(-45deg)
  
  #canvas
    
    .mask
      z-index 1
      opacity 1
      transform translate3d($nav-width, 0, 0)
      transition opacity $timing $ease, transform $timing $ease
      
    #nav
    ^[0] #fix-bar .logo
      transform translate3d(0, 0, 0)

    #content
      transform translate3d($nav-width, 0, 0)
  
            
          
!
            
              // TODO refact stylus
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console