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

              
                <div id="nav-drawer">
  <input id="nav-input" type="checkbox" class="nav-unshown">
  <label class="nav-unshown" id="nav-close" for="nav-input"></label>
  <div id="nav-menu">
    <div class="nav-button"><label id="nav-open" for="nav-input"><span></span></label></div>
    <div class="content">ここに中身を入れる</div>
  </div>
</div>
<body>
  <div id="toc_container">
    <p class="toc_title">目次</p>
    <ul class="toc_list">
      <li><a href="#">1.項目</a></li>
      <li><a href="#">2.項目</a></li>
      <li><a href="#">3.項目</a></li>
      <li><a href="#">4.項目</a></li>
    </ul>
  </div>
  <p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p><p>text</p>
</body>
              
            
!

CSS

              
                #nav-drawer {
  position: relative;
}
.nav-unshown{
  display: none;
}
.nav-button{
  position: absolute;
  top: 0;
  right: -50px;
  width: 50px;
  height: 50px;
  background: #689EFB;/*ボックス背景色*/
	color:#fff;/*文字色*/
  text-align: center;
}
.nav-button:after{
  position: relative;
  bottom: 4px;/*テキスト下からの位置*/
  content: "open";
}
#nav-open{
  position: relative;
  margin: 0 auto;
  width:30px;/*アイコンサイズ*/
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#nav-open span, #nav-open span:before, #nav-open span:after {
  position: relative;
  height: 3px;/*線の太さ*/
  width: 25px;/*長さ*/
  border-radius: 3px;
  background: #fff;/*アイコン色*/
  display: block;
  content: '';
  transition: all 0.5s ease-in-out;/*アニメーションの速さ*/
}
#nav-open span:before{
  top: -10px;
}
#nav-open span:after{
  top: 7px;
}
/*閉じる用の薄黒カバー*/
#nav-close {
  display: none;/*はじめは隠しておく*/
  position: fixed;
  z-index: 99;
  top: 0;/*全体に広がるように*/
  left: 0;
  width: 100%;
  height: 100%;
  background: black;
  opacity: 0;
  transition: .3s ease-in-out;
}
/*メニューフィールド*/
#nav-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;/*最前面に*/
  width: 90%;/*右側に隙間を作る(閉じるカバーを表示)*/
  max-width: 330px;/*最大幅(調整してください)*/
  height: 100%;
  background: #fff;/*背景色*/
  transition: .3s ease-in-out;/*滑らかに表示*/
  transform: translateX(-100%);/*左に隠しておく*/
}
/*中身*/
#nav-menu .content{
  overflow: auto;
  width: 95%;
  height: 95%;
  margin: 2.5%;
}
/*チェックが入ったらもろもろ表示*/
#nav-input:checked ~ #nav-close {
  display: block;/*カバーを表示*/
  opacity: .5;
}
#nav-input:checked ~ #nav-menu {
  transform: translateX(0%);/*中身を表示(右へスライド)*/
  box-shadow: 6px 0 25px rgba(0,0,0,.15);
}
#nav-input:checked ~ #nav-menu .nav-button #nav-open span:before{
  top: 0;
  transform: rotateZ(45deg) scale(4);
}
#nav-input:checked ~ #nav-menu .nav-button #nav-open span{
  transform: scale(0.25) rotateY(360deg);
}
#nav-input:checked ~ #nav-menu .nav-button #nav-open span:after{
  top: -3px;
  transform: rotateZ(-45deg) scale(4);
}
#nav-input:checked ~ #nav-menu .nav-button:after{
  content: "close";
}

/*目次*/
#toc_container {
	display: block;
	text-align: center;
	border: 1px solid rgba(0,35,179,1.00);
	background-color: rgba(213,241,255,1.00);
	max-width: 450px;
  width: 90%;
	position: static;
	margin-left: auto;
	margin-right: auto;
  border-radius: 5px;
}
#toc_container .toc_title {
	font-weight: bold;
}
#toc_container .toc_list {
	width: 90%;
	text-align: left;
	list-style-type: none;
}
#toc_container .toc_list li a {
	text-decoration: none;
	color: rgba(90,90,90,1.00);
}
/*idを追加することで個別にスタイル適用可能*/
#nav-menu #toc_container{
  background: #fff;/*目次の背景を白*/
}
              
            
!

JS

              
                $('#toc_container').clone().appendTo('#nav-menu .content');
              
            
!
999px

Console