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

              
                <body>
        <!--ドロップダウンメニュー-->
        <div id="dropdownmenu">
            <div class="menu bigmenu">
                <!--ドロップダウン状態を判断するチェックボックス(非表示)-->
                <input type="checkbox" id="menu--toggle1" class="menu--toggle">
                
                <!--ドロップダウン状態を切り替えるラベル checkboxのIDを指定-->
                <label for="menu--toggle1" class="menu--label">
                    <!--メニューのタイトル-->
                    <h2 class="menu--label--title">商品情報</h2>
                    <!--アイコン ドロップダウン状態に応じて変化-->
                    <span class="menu--label--icon"></span>
                </label>
                
                <!--ドロップダウン項目-->
                <div class="menu--dropdownarea">
                    <div class="menu smallmenu">
                        <!--ドロップダウン状態を判断するチェックボックス(非表示)-->
                        <input type="checkbox" id="menu--toggle1-1" class="menu--toggle">
                        
                        <!--ドロップダウン状態を切り替えるラベル checkboxのIDを指定-->
                        <label for="menu--toggle1-1" class="menu--label">
                            <!--メニューのタイトル-->
                            <h3 class="menu--label--title">セール商品</h3>
                            <!--アイコン ドロップダウン状態に応じて変化-->
                            <span class="menu--label--icon"></span>
                        </label>
                        
                        <!--ドロップダウン項目-->
                        <div class="menu--dropdownarea">
                            <p>生活家電</p>
                            <p>情報家電</p>
                            <p>美容家電</p>
                        </div>
                       
                    </div>
                </div>
               
            </div>
        </div>
    </body>
              
            
!

CSS

              
                *{margin:0;padding:0;box-sizing: border-box;transition:1s;}
#dropdownmenu{
    display:flex;
    .menu{


        > .menu--toggle{
            //display: none;
        }
        > .menu--label{
            display:flex;
            align-items: center;
            justify-content: space-around;
            background-color: lightblue;
            border: 1px solid lightgray;
            position:relative;

            > .menu--label--icon{
                height: 1rem;
                width:1rem;
                margin: 0.5rem;
                position: relative;
                
                &::before,&::after{
                    width:58%;
                }
                
                &::before, &::after{
                    content:"";
                    position: absolute;
                    top:0;
                    height: 5%;
                    background-color: black;
                    transition:1s
                }
                &::before{
                    left:0;
                    transform:rotate(45deg);
                }
                &::after{
                    right:0;
                    transform:rotate(-45deg);
                }
            }
        }
        > .menu--dropdownarea{
            background-color: lightgray;
        }

        > .menu--toggle:not(:checked){
            ~ .menu--label{
                > .menu--label--icon{
                    transform: rotate(-90deg);
                }
            }
            ~ .menu--dropdownarea{
                padding:0;
                border: none;
                *{
                    display: none;
                }
            }
        }
        > .menu--toggle:checked{
            ~ .menu--label{
                > .menu--label--icon{
                    transform: translateY(50%);
                }
            }
            ~ .menu--dropdownarea{
                border: 1px solid gray;
            }
        }
    }
    .bigmenu{
        width:25%;
        > .menu--label{
            background-color:lightblue;
        }
    }
    .smallmenu{
        width: 100%;
        position: relative;
        > .menu--label{
            background-color:aliceblue;
        }
        > .menu--dropdownarea{
            position: absolute;
            top:0;
            width: 100%;
            left:100%;
        }
    }
}
              
            
!

JS

              
                
              
            
!
999px

Console