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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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="tree" id="tree">
  <details>
    <details>
      <summary>
        <span class="tree-item">文件夹0</span>
      </summary>
    </details>
    <summary>
      <span class="tree-item">项目1</span>
    </summary>
    <details>
      <summary>
        <span class="tree-item">文件夹0</span>
      </summary>
    </details>
    <details>
      <summary>
        <span class="tree-item">文件夹1-1</span>
      </summary>
      <details>
        <summary>
          <span class="tree-item">文件夹1-1-2</span>
        </summary>
      </details>
      <details>
        <summary>
          <span class="tree-item">文件夹1-1-3</span>
        </summary>
        <details>
          <summary>
            <span class="tree-item">文件夹1-1-3-1</span>
          </summary>
        </details>
        <details>
          <summary>
            <span class="tree-item">文件夹1-1-3-2</span>
          </summary>
        </details>
      </details>
      <details>
        <summary>
          <span class="tree-item">文件夹1-1-4</span>
        </summary>
      </details>
    </details>
    <details>
      <summary>
        <span class="tree-item">文件夹1-2</span>
      </summary>
      <details>
        <summary>
          <span class="tree-item">文件夹1-2-1</span>
        </summary>
      </details>
    </details>
    <details>
      <summary>
        <span class="tree-item">文件夹1-3</span>
      </summary>
    </details>
    <details>
      <summary>
        <span class="tree-item">文件夹1-4</span>
      </summary>
    </details>
  </details>
  <details>
    <summary>
      <span class="tree-item">项目1</span>
    </summary>
    <details>
      <summary>
        <span class="tree-item">文件夹0</span>
      </summary>
    </details>
    <details>
      <summary>
        <span class="tree-item">文件夹1-1</span>
      </summary>
      <details>
        <summary>
          <span class="tree-item">文件夹1-1-2</span>
        </summary>
      </details>
      <details>
        <summary>
          <span class="tree-item">文件夹1-1-3</span>
        </summary>
        <details>
          <summary>
            <span class="tree-item">文件夹1-1-3-1</span>
          </summary>
        </details>
        <details>
          <summary>
            <span class="tree-item">文件夹1-1-3-2</span>
          </summary>
        </details>
      </details>
      <details>
        <summary>
          <span class="tree-item">文件夹1-1-4</span>
        </summary>
      </details>
    </details>
    <details>
      <summary>
        <span class="tree-item">文件夹1-2</span>
      </summary>
      <details>
        <summary>
          <span class="tree-item">文件夹1-2-1</span>
        </summary>
      </details>
    </details>
    <details>
      <summary>
        <span class="tree-item">文件夹1-3</span>
      </summary>
    </details>
    <details>
      <summary>
        <span class="tree-item">文件夹1-4</span>
      </summary>
    </details>
  </details>
</div>
              
            
!

CSS

              
                html,body{
    margin: 0;
    height: 100%;
}
::-webkit-details-marker {
    display: none;
}
::-moz-list-bullet {
    font-size: 0;
    float: left;
}
.tree{
    flex: 1;
    overflow: auto;
    padding: 4px 0;
    position: relative;
    width: 300px;
    height: 100%;
  margin: 0 auto;
}
.tree summary{
    outline: 0;
    padding-left: 20px;
    list-style: none;
    /* display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden; */
}
.tree summary:not(:only-child){
    background: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.354 2.646A.5.5 0 0 0 4.5 3v6a.5.5 0 0 0 .854.354l3-3a.5.5 0 0 0 0-.708l-3-3z' fill='%23000' fill-opacity='.45'/%3E%3C/svg%3E") 4px center no-repeat;
}
.tree details[open]>summary:not(:only-child){
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.354 5.354A.5.5 0 0 0 9 4.5H3a.5.5 0 0 0-.354.854l3 3a.5.5 0 0 0 .708 0l3-3z' fill='%23000' fill-opacity='.45'/%3E%3C/svg%3E");
}
.tree details{
    padding-left: 10px
}
.tree-item{
    display: flex;
    align-items: center;
    height: 46px;
    font-size: 15px;
    line-height: 22px;
    color: rgba(0, 0, 0, 0.85);
    padding-left: 400px;
    margin-left: -400px;
    cursor: default;
}
.tree-item::after{
    content: '';
    position: absolute;
    left: 10px;
    right: 10px;
    height: 38px;
    background: #EEF2FF;
    border-radius: 8px;
    z-index: -1;
    opacity: 0;
    transition: .2s;
}
.tree-item:hover::after{
    opacity: 1;
}
.tree-item::before{
    content: '';
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-right: 8px;
    background: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M.833 3.75c0-.92.746-1.667 1.667-1.667h5.417c.247 0 .481.11.64.3l1.833 2.2h7.11c.92 0 1.667.747 1.667 1.667v10c0 .92-.747 1.667-1.667 1.667h-15c-.92 0-1.667-.746-1.667-1.667V3.75zm6.693 0H2.5v4.584h15V6.25H10a.833.833 0 0 1-.64-.3l-1.834-2.2zM17.5 10h-15v6.25h15V10z' fill='%23000' fill-opacity='.45'/%3E%3C/svg%3E") center no-repeat;
}
.tree details[open]>summary:not(:only-child)>.tree-item::before{
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M7.917 2.083c.247 0 .481.11.64.3l1.833 2.2h5.443c.92 0 1.667.747 1.667 1.667v1.667h.833a.833.833 0 0 1 .817.997l-1.666 8.333a.833.833 0 0 1-.817.67H1.677a.814.814 0 0 1-.157-.013.83.83 0 0 1-.687-.82V3.75c0-.92.746-1.667 1.667-1.667h5.417zM10 6.25a.833.833 0 0 1-.64-.3l-1.834-2.2H2.5v6.564l.441-1.766a.833.833 0 0 1 .809-.631h12.083V6.25H10zm-7.266 10L4.4 9.584h12.916l-1.334 6.666H2.733z' fill='%23000' fill-opacity='.45'/%3E%3C/svg%3E");
}
              
            
!

JS

              
                
              
            
!
999px

Console