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">
  <div class="logo">TEST</div><!-- /.logo -->

  <!-- ハンバーガーメニュー部分 -->
  <div class="drawer">
    <!-- ハンバーガーメニューの表示・非表示を切り替えるチェックボックス -->
    <input type="checkbox" id="drawer-check" class="drawer-hidden" >

    <!-- ハンバーガーアイコン -->
    <label for="drawer-check" class="drawer-open"><span></span></label>

    <!-- 追加:メニューを閉じるための要素 -->
    <label for="drawer-check" class="drawer-close"></label>

    <!-- メニュー -->
    <nav class="drawer-content">
      <ul class="drawer-list">
        <li class="drawer-item">
          <a href="">リンク1</a>
        </li><!-- /.drawer-item -->
        <li class="drawer-item">
          <a href="">リンク2</a>
        </li><!-- /.drawer-item -->
        <li class="drawer-item">
          <a href="">リンク3</a>
        </li><!-- /.drawer-item -->
      </ul><!-- /.drawer-list -->
    </nav>

  </div>
</header>
              
            
!

CSS

              
                .header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  background: #fff;
}

.logo {
  font-size: 24px;
}

/*------------------------------

  ここから下がハンバーガーメニュー
  に関するCSS

------------------------------*/
  
/* チェックボックスは非表示に */
.drawer-hidden {
  display: none;
}

/* ハンバーガーアイコンの設置スペース */
.drawer-open {
  display: flex;
  height: 60px;
  width: 60px;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 98;/* 重なり順を一番下に */
  cursor: pointer;
}

/* ハンバーガーメニューのアイコン */
.drawer-open span,
.drawer-open span:before,
.drawer-open span:after {
  content: '';
  display: block;
  height: 3px;
  width: 25px;
  border-radius: 3px;
  background: #333;
  transition: 0.5s;
  position: absolute;
}

/* 三本線のうち一番上の棒の位置調整 */
.drawer-open span:before {
  bottom: 8px;
}

/* 三本線のうち一番下の棒の位置調整 */
.drawer-open span:after {
  top: 8px;
}
  
/* メニューのデザイン*/
.drawer-content {
  width: 70%;/* ここの割合を小さくすると閉じる部分の領域が広がる */
  height: 100%;
  position: fixed;
  top: 0;
  left: 100%;/* メニューを画面外へ */
  z-index: 100;/* 重なり順を一番上に */
  background: #fff;
  transition: .5s;
}

/* アイコンがクリックされたらメニューを表示 */
#drawer-check:checked ~ .drawer-content {
  left: 0;/* メニューを画面内へ */
}

/* メニューを閉じるための要素のデザイン*/
.drawer-close {
  width: 100%;
  height: 100%;
  background: red;
  position: fixed;
  top: 0;
  left: 100%;/* 閉じる要素を画面外へ */
  z-index: 99;/* 重なり順をメニューより下に*/
  transition: .5s;
}

#drawer-check:checked ~ .drawer-close {
  left: 0;/* 閉じる要素を画面内へ */
}
              
            
!

JS

              
                
              
            
!
999px

Console