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

              
                <div class="section s_07">

  <div class="accordion_one">
    <div class="accordion_header">アコーディオンで多階層のメニューを作る<div class="i_box"><i class="one_i"></i></div></div>
    <div class="accordion_inner">
      <div class="accordion_one">
        <div class="accordion_header">A<div class="i_box"><i class="one_i"></i></div></div>
        <div class="accordion_inner">
          <div class="accordion_one">
            <div class="accordion_header">A_a</div>
            <div class="accordion_header">A_b</div>
          </div>
        </div>
      </div>
      <div class="accordion_one">
        <div class="accordion_header">B<div class="i_box"><i class="one_i"></i></div></div>
        <div class="accordion_inner">
          <div class="accordion_one">
            <div class="accordion_header">B_a</div>
            <div class="accordion_header">B_b</div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="accordion_one">
    <div class="accordion_header">アコーディオンで多階層のメニューを作る<div class="i_box"><i class="one_i"></i></div></div>
    <div class="accordion_inner">
      <div class="accordion_one">
        <div class="accordion_header">A<div class="i_box"><i class="one_i"></i></div></div>
        <div class="accordion_inner">
          <div class="accordion_one">
            <div class="accordion_header">A_a</div>
            <div class="accordion_header">A_b</div>
          </div>
        </div>
      </div>
      <div class="accordion_one">
        <div class="accordion_header">B<div class="i_box"><i class="one_i"></i></div></div>
        <div class="accordion_inner">
          <div class="accordion_one">
            <div class="accordion_header">B_a</div>
            <div class="accordion_header">B_b</div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="accordion_one">
    <div class="accordion_header">アコーディオンで多階層のメニューを作る<div class="i_box"><i class="one_i"></i></div></div>
    <div class="accordion_inner">
      <div class="accordion_one">
        <div class="accordion_header">A<div class="i_box"><i class="one_i"></i></div></div>
        <div class="accordion_inner">
          <div class="accordion_one">
            <div class="accordion_header">A_a</div>
            <div class="accordion_header">A_b</div>
          </div>
        </div>
      </div>
      <div class="accordion_one">
        <div class="accordion_header">B<div class="i_box"><i class="one_i"></i></div></div>
        <div class="accordion_inner">
          <div class="accordion_one">
            <div class="accordion_header">B_a</div>
            <div class="accordion_header">B_b</div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <p class="_a"><a href="https://125naroom.com/web/3046" target="_blank" class="link">View the note</a></p>
</div>
              
            
!

CSS

              
                /*====================================================================
.s_07 .accordion_one
====================================================================*/
.s_07 .accordion_one {
  max-width: 1024px;
  margin: 0 auto;
}
.s_07 .accordion_one .accordion_header {
  background-color: #db0f2f;
  border-bottom: 1px solid #fff;
  color: #fff;
  font-size: 26px;
  font-weight: bold;
  padding: 20px 11%;
  text-align: center;
  position: relative;
  z-index: +1;
  cursor: pointer;
  transition-duration: 0.2s;
}
.s_07 .accordion_one:nth-of-type(1) .accordion_inner .accordion_header {
  background-color: #f52d4c;
}
.s_07 .accordion_one:nth-of-type(1) .accordion_inner .accordion_inner  .accordion_header {
  background-color: #ff667e;
}
.s_07 .accordion_one:nth-of-type(2) .accordion_header {
  background-color: #ff9a05;
}
.s_07 .accordion_one:nth-of-type(2) .accordion_inner .accordion_header {
  background-color: #ffb64a;
}
.s_07 .accordion_one:nth-of-type(2) .accordion_inner .accordion_inner  .accordion_header {
  background-color: #ffce85;
}
.s_07 .accordion_one:nth-of-type(3) .accordion_header {
  background-color: #1c85d8;
}
.s_07 .accordion_one:nth-of-type(3) .accordion_inner .accordion_header {
  background-color: #4cacf9;
}
.s_07 .accordion_one:nth-of-type(3) .accordion_inner .accordion_inner  .accordion_header {
  background-color: #85c9ff;
}
.s_07 .accordion_one .accordion_header:hover {
  opacity: .8;
}
.s_07 .accordion_one .accordion_header .i_box {
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 50%;
  right: 5%;
  width: 40px;
  height: 40px;
  border: 1px solid #fff;
  margin-top: -20px;
  box-sizing: border-box;
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
  transform-origin: center center;
  transition-duration: 0.2s;
}
.s_07 .accordion_one .accordion_header .i_box .one_i {
  display: block;
  width: 18px;
  height: 18px;
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
  transform-origin: center center;
  transition-duration: 0.2s;
  position: relative;
}
.s_07 .accordion_one .accordion_header.open .i_box {
  -webkit-transform: rotate(-360deg);
  transform: rotate(-360deg);
}
.s_07 .accordion_one .accordion_header .i_box .one_i:before, .s_07 .accordion_one .accordion_header .i_box .one_i:after {
  display: flex;
  content: '';
  background-color: #fff;
  border-radius: 10px;
  width: 18px;
  height: 4px;
  position: absolute;
  top: 7px;
  left: 0;
  -webkit-transform: rotate(0deg);
  transform: rotate(0deg);
  transform-origin: center center;
}
.s_07 .accordion_one .accordion_header .i_box .one_i:before {
  width: 4px;
  height: 18px;
  top: 0;
  left: 7px;
}
.s_07 .accordion_one .accordion_header.open .i_box .one_i:before {
  content: none;
}
.s_07 .accordion_one .accordion_header.open .i_box .one_i:after {
  -webkit-transform: rotate(-45deg);
  transform: rotate(-45deg);
}
.s_07 .accordion_one .accordion_inner {
  display: none;
  padding: 0;
  box-sizing: border-box;
}
.s_07 .accordion_one .accordion_inner .box_one {
  height: 300px;
}
.s_07 .accordion_one .accordion_inner p.txt_a_ac {
  margin: 0;
}
@media screen and (max-width: 1024px) {
  .s_07 .accordion_one .accordion_header {
    font-size: 18px;
  }
  .s_07 .accordion_one .accordion_header .i_box {
    width: 30px;
    height: 30px;
    margin-top: -15px;
  }
}
@media screen and (max-width: 767px) {
  .s_07 .accordion_one .accordion_header {
    font-size: 16px;
    text-align: left;
    padding: 15px 60px 15px 15px;
  }
}

/*====================================================================
以下は不要です。
====================================================================*/

body {
  font-family: YuGothic, "游ゴシック体", "Yu Gothic", "ヒラギノ角ゴ Pro", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, "MS Pゴシック", "MS PGothic", sans-serif;
  font-size: 16px;
  letter-spacing: .025em;
  line-height: 1.8;
  margin: 0;
}
@media screen and (max-width: 1024px) {
  body {
    font-size: 14px;
  }
}
.section {
  max-width: 1024px;
  margin: 0 auto;
  padding: 20px 20px 500px;
}
.section p._a {
  font-size: 12px;
  font-weight: bold;
  margin: 30px 0 0;
}
.section p._a .link {
  display: inline-block;
  color: #607D8B;
  padding-left: 1.3em;
  text-indent: -1.3em;
}
.section p._a .link:before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-top: 2px solid #607D8B;
  border-right: 2px solid #607D8B;
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
  margin-right: 10px;
}
              
            
!

JS

              
                // .s_07 .accordion_one
$(function(){
  //.accordion_oneの中の.accordion_headerがクリックされたら
  $('.s_07 .accordion_one .accordion_header').click(function(){
    //クリックされた.accordion_oneの中の.accordion_headerに隣接する.accordion_innerが開いたり閉じたりする。
    $(this).next('.accordion_inner').slideToggle();
    $(this).toggleClass("open");
  });
});
              
            
!
999px

Console