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 class="container">
    <figure class="accordion-panel">
        <img class="accordion-image" src="https://cdn.pixabay.com/photo/2012/06/19/10/32/owl-50267_1280.jpg">
        <input class="accordion-tab" type="radio" name="radio-set" checked="checked"/>
        <figcaption class="accordion-caption"><span>stroll</span></figcaption>
        <figure class="accordion-panel">
            <img class="accordion-image" src="https://cdn.pixabay.com/photo/2020/03/01/15/30/fox-4893199_1280.jpg" alt="image02" />
            <input class="accordion-tab" type="radio" name="radio-set" />
            <figcaption class="accordion-caption"><span>families</span></figcaption>
            <figure class="accordion-panel">
                <img class="accordion-image" src="https://cdn.pixabay.com/photo/2017/01/14/12/59/iceland-1979445_1280.jpg" alt="image03" />
                <input class="accordion-tab" type="radio" name="radio-set" />
                <figcaption class="accordion-caption"><span>fawn on</span></figcaption>
                <figure class="accordion-panel">
                    <img class="accordion-image" src="https://cdn.pixabay.com/photo/2018/08/12/16/59/ara-3601194_1280.jpg" alt="image04" />
                    <input class="accordion-tab" type="radio" name="radio-set" />
                    <figcaption class="accordion-caption"><span>solitary</span></figcaption>
                    <figure class="accordion-panel">
                        <img class="accordion-image" src="https://cdn.pixabay.com/photo/2016/11/14/04/45/elephant-1822636_1280.jpg" alt="image05" />
                        <input class="accordion-tab accordion-tab-last" type="radio" name="radio-set" />
                        <figcaption class="accordion-caption"><span>conversation</span></figcaption>
                    </figure>    
                </figure>
            </figure>
        </figure>
    </figure>
</div>
              
            
!

CSS

              
                .accordion-panel-container {  /* アコーディオン全体 */
    width: 638px;  /* 全体の幅.テーマに合わせる */
    box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.08);
    border: 7px solid rgba(255, 255, 255, 0.6);
}
.accordion-panel {  /* パネル */
    position: absolute;
    left: 40px;  /* タブとして見せる幅 */
    width: 478px;  /* 画像の幅 */
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
}
.accordion-panel-container > .accordion-panel {  /* 先頭のパネル */
    position: relative;
    left: 0;
}

.accordion-tab {  /* タブ */
    width: 40px;  /* 反応する幅 */
    height: 100%;
    cursor: pointer;
    z-index: 100;
}

/* パネルをアコーディオン状に開く */
/*
body{
    font-family: 'Open Sans Condensed','Arial Narrow', serif;
    background-color: aliceblue;
}
*/
.accordion-panel-container {
    position: relative;
    width: 638px;
    margin: 20px auto;
    overflow: hidden;
    box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.08);
    border: 7px solid rgba(255, 255, 255, 0.6);
}
.accordion-panel {
    margin: 0;
    position: absolute;
    top: 0;
    left: 40px;
    width: 478px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
    transition: 0.3s ease-in-out;
}
.accordion-panel-container > .accordion-panel {
    position: relative;
    left: 0;
}
.accordion-image {
    display: block;
}
.accordion-tab {
    position: absolute;
    top: 0;
    width: 40px;
    height: 100%;
    cursor: pointer;
    opacity: 0;
    z-index: 100;
}
.accordion-tab:checked {
    right: 0;
    width: 0;
}
.accordion-tab:checked ~ .accordion-panel {
    left: 478px;
    transition: 0.7s ease-in-out;
}

.accordion-caption span {
    position: absolute;
    top: 40%;
    margin-top: -20px;
    left: 20px;
    right: 20px;
    text-align: center;
    background: rgba(47, 79, 79, 0.25);
    line-height: 10px;
    font-size: 18px;
    opacity: 0;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: 700;
    padding: 20px;
    color: #fff;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
}

/* 開いた画像と選んだタブを明るく表示 */
.accordion-caption {
    width: 100%;
    height: 100%;
    background: rgba(47, 79, 79, 0.25);
    position: absolute;
    top: 0;
    transition: 0.2s linear;
}
.accordion-tab:checked + .accordion-caption {
    background: rgba(47, 79, 79, 0);
}

.accordion-tab:hover + .accordion-caption {
    background: rgba(47, 79, 79, 0.1);
}
              
            
!

JS

              
                
              
            
!
999px

Console