Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<div class="accordions">
  <dl class="accordion">
    <dt class="accordion__title">
      <button class="accordion__btn" type="button">フィヨルドブートキャンプではどのようなことが学べるのですか?</button>
    </dt>
    <dd class="accordion__body">
      <p class="accordion__text">
        Railsプログラマーコースでは、Ruby on RailsでWebアプリケーションを開発できるプログラマーになるためのカリキュラムが組まれています。プログラミング言語RubyやRailsの知識だけではなく、HTML,CSS,Javascript,開発環境の構築,サーバ構築,テスト自動化,CI/CDなどWEBエンジニアとして求められる知識をトータルで学ぶことができます。
      </p>
    </dd>
    <dt class="accordion__title">
      <button class="accordion__btn" type="button">フィヨルドブートキャンプを卒業するのに、どれくらい時間がかかりますか?</button>
    </dt>
    <dd class="accordion__body">
      <p class="accordion__text">
        学習を始める前の知識や、取り組み方によって個人差があります。平均的すると約900時間で全カリキュラムを終えて卒業されています。
      </p>
    </dd>
    <dt class="accordion__title">
      <button class="accordion__btn" type="button">学習をしなければいけないのにモチベーションが上がらない。そんな時どうすれば良いですか?</button>
    </dt>
    <dd class="accordion__body">
      <p class="accordion__text">
        ずっと同じペースで学び続けることは難しいと思います。だって人間だもの。壁にぶつかった時は、それを乗り越えることに楽しみを見いだすのも一つの方法です。また、しばらく距離を置いて、またやる気が芽生えてきたときに再チャレンジするというのも良いですね。
      </p>
    </dd>
  </dl>
</div>

              
            
!

CSS

              
                /* よくある質問 */
.accordions {
    margin-bottom: 30px;
}

.accordion__body + .accordion__title {
    margin-top: 20px;
}

.accordion__btn {
    position: relative;
    display: block;
    width: 100%;
    padding: 10px 40px 10px 15px;
    background-color: #027fff;
    border: 2px solid #027fff;
    color: #fff;
    font-size: 1.6rem;
    text-align: left;
    cursor: pointer;
    transition: .25s;
}

.accordion__btn::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 15px;
    display: block;
    width: 20px;
    height: 2px;
    background-color: currentColor;
    transform: translateY(-50%);
}

.accordion__btn::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 24px;
    display: block;
    width: 2px;
    height: 20px;
    background-color: currentColor;
    transform: translateY(-50%);
}

.accordion__btn:focus,
.accordion__btn:hover {
    background-color: #fff;
    color: #027fff;
}

.accordion__btn--active::after {
    content: none;
}

.accordion__body {
    display: none;
    padding: 15px;
    border: 1px solid #ddd;
}

.accordion__body > *:last-child {
    margin-bottom: 0;
}

.accordion__body--active {
    display: block;
}

.accordion__text {
    margin-bottom: 20px;
    font-size: 1.6rem;
}

              
            
!

JS

              
                $(document).ready(function () {
    $(".accordion__btn").on("click", function(){
        $(this).toggleClass("accordion__btn--active");
        $(this).parent("dt").next().toggleClass("accordion__body--active");
    });
});

              
            
!
999px

Console