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

              
                
<div class="shape-ex2">
    <ul class="shape-ex2-list-box">
        <li class="shape-ex2-list">
            <label class="shape-ex2-list-name" for="ex2_1-checkbox">第一層</label>
            <input type="checkbox" name="ex2_1-input" id="ex2_1-checkbox" />
            <ul class="shape-ex2-list-sec-box">
                <li class="shape-ex2-list-sec">
                    <label class="shape-ex2-list-sec-name" for="ex2_2_1-checkbox">第二層</label>
                    <input type="radio" name="ex2_2-input" id="ex2_2_1-checkbox" />
                    <ul class="shape-ex2-list-thr-box">
                        <li class="shape-ex2-list-thr-name"><span>第三層</span></li>
                        <li class="shape-ex2-list-thr-name"><span>第三層</span></li>
                    </ul>
                </li>
                <li class="shape-ex2-list-sec">
                    <label class="shape-ex2-list-sec-name" for="ex2_2_2-checkbox">第二層</label>
                    <input type="radio" name="ex2_2-input" id="ex2_2_2-checkbox" />
                    <ul class="shape-ex2-list-thr-box">
                        <li class="shape-ex2-list-thr-name"><span>第三層</span></li>
                        <li class="shape-ex2-list-thr-name"><span>第三層</span></li>
                    </ul>
                </li>
            </ul>
        </li>
    </ul>
</div>


              
            
!

CSS

              
                .shape-ex2{
    display: block;
    transition: all .3s linear;
}
.shape-ex2 ul{
    padding-inline-start: 0px;
}
.shape-ex2 li::marker{
    font-size: 0;
}
.shape-ex2 input[type="checkbox"],
.shape-ex2 input[type="radio"]{
    position: absolute;
    opacity: 0;
    pointer-events: none;
    top: 0;
}
.shape-ex2-list-box{
    min-width: max-content;
    width: 224px;
}
.shape-ex2-list{
    position: relative;
}
.shape-ex2-list-name{
    font-size: 1.5rem;
    line-height: 2rem;
    padding-right: 1.25rem;
    padding-left: 0.625rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    background-color: rgb(209 213 219);
    display: block;
    min-width: max-content;
    position: relative;
}
.shape-ex2-list-name::after{
    content:'';
    width: 0;
    height: 0;
    border-top: 8px solid #000;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    position: absolute;
    top: calc(50% - 4px);
    right: 6px;
}
.shape-ex2-list-sec-box{
    display: none;
}
.shape-ex2-list-sec{
    position: relative;
}
.shape-ex2-list-sec-name{
    font-size: 1.125rem;
    line-height: 1.75rem;
    padding-right: 1.25rem;
    padding-left: 0.625rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    background-color: rgb(229 231 235);
    min-width: max-content;
    display: block;
    position: relative;
}
.shape-ex2-list-sec-name::after{
    content:'';
    width: 0;
    height: 0;
    border-left: 8px solid #000;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    position: absolute;
    top: calc(50% - 4px);
    right: 6px;
}
.shape-ex2-list-thr-box{
    display: none;
    position: absolute;
    top: 0px;
    left: 100%;
}
.shape-ex2-list-thr-name{
    font-size: 1rem;
    line-height: 1.5rem;
    padding-left: 0.625rem;
    padding-right: 0.625rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    background-color: rgb(243 244 246);
    min-width: max-content;
    display: block;
    position: relative;
}
.shape-ex2 input[type="checkbox"]:checked + ul,
.shape-ex2 input[type="radio"]:checked + ul{
    display: block;
}

              
            
!

JS

              
                
              
            
!
999px

Console