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. 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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="l-header">
  <!-- ドロワーエリア -->
  <div class="l-drawer">
    <input class="l-drawer__checkbox" id="drawerCheckbox" type="checkbox" >
    <!-- ドロワーアイコン -->
    <label class="l-drawer__icon" for="drawerCheckbox">
      <span class="l-drawer__icon-parts"></span>
    </label>
    <!-- 背景を暗く -->
    <label class="l-drawer__overlay" for="drawerCheckbox"></label>
    <!-- ドロワーメニュー -->
    <nav class="l-drawer__menu">
      <ul>
        <li class="l-drawer__item">
          <a class="l-drawer__item-inner" href="/">メニュー</a>
        </li>
        <li class="l-drawer__item">
          <a class="l-drawer__item-inner" href="/">メニュー</a>
        </li>
        <li class="l-drawer__item">
          <a class="l-drawer__item-inner" href="/">メニュー</a>
        </li>
      </ul>
    </nav>
  </div><!-- /ドロワーメニュー -->
</header><!-- /ヘッダーエリア -->
<p>aaaa
</p>
<p>aaaa
</p>
<p>aaaa
</p><p>aaaa
</p>
<p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p><p>aaaa
</p>v
              
            
!

CSS

              
                /*ヘッダー*/
.l-header {
  background: pink;
  width: 100%;
  height: 60px;
  position: fixed;
  top: 0;
  left: 0;
}

/*ドロワー*/
.l-drawer {
  position: relative;
  // inputのcheckboxは非表示
  &__checkbox{
    display: none;
  }
  // ハンバーガーアイコン
  &__icon{
    cursor: pointer;
    display: block;
    width: 56px;
    height: 60px;
    position: fixed;
    right: 0;
    // ハンバーガーアイコンの中の線
    &-parts,
    &-parts:before,
    &-parts:after{
      background-color: #000;   
      display: block;
      width: 26px;
      height: 2px;
      position: absolute;
      top: 0;
      right: 0;
      left: 0;
      bottom: 0;
      margin: auto;
    }
    &-parts:before,
    &-parts:after{
      content: " ";
    }
    &-parts:before{
      top: 16px
    }
    &-parts:after{
      top: -16px
    }
  }
  
  // ドロワーメニュー開いた時のメインエリアを暗く
  &__overlay{
    background: #000;
    opacity: 0;
    pointer-events: none; //ポインタの動作全部無効化
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    right: 0;
  }
  
  // ドロワーメニュー
  &__menu{
    background: #ffffff;
    color: #000;
    max-width: 100%;
    width: 320px;
    height: 100vh;
    overflow-y: auto; //スクロール
    -webkit-overflow-scrolling: touch; //スクロール(SP)
    position: fixed;
    top: 0;
    right: -320px;
  }
  // z-indexの指定(1がメインエリア)
  &__icon{
    z-index: 4;
  }
  &__menu{
    z-index: 3;
  }
  &__overlay{
    z-index: 2;
  }
  
  // チェックが入ったら(アイコンクリックしたら)
  &__checkbox:checked ~ {
    // ハンバーガーアイコン
    .l-drawer__icon{
      .l-drawer__icon-parts{
        background: transparent;
      }
      .l-drawer__icon-parts:before{
        -webkit-transform: rotate(-45deg);
        transform: rotate(-45deg);
        top: 0;
      }
      .l-drawer__icon-parts:after{
        -webkit-transform: rotate(45deg);
        transform: rotate(45deg);
        top: 0;
      }
    }
    // メインエリアを暗くする
    .l-drawer__overlay {
      opacity: 0.3;
      pointer-events: auto; //ポインタの動作デフォルトに戻す
    }
    // メニューをだす
    .l-drawer__menu {
      right: 0;
    }
  }
  // 動きをスムーズに
  &__icon-parts,
  &__icon-parts:after,
  &__icon-parts:before,
  &__overlay,
  &__menu{
    -webkit-transition: all .7s ;
    transition: all .7s ;
  }
}


              
            
!

JS

              
                
              
            
!
999px

Console