Pen Settings



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


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


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.


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.





  一、input[type="radio"] 需要設 name 的屬性,這樣才會成為同一組 tabs。
  二、隱藏 input
  三、當 .tabs 設為 flex 後,input、label、.tab-content 會變成 flex-item,由於 order 的預設值為 0,
     所以當 .tab-content 的 order 設為 1 時,順序上會排在 input 及 label 之後。
     因此,當我們將 .tab-content 的寬度設為 100%,它就會觸發 flex-wrap 而換行。
  四、完成上面的設定後,需要將 .tab-content 的 display 設為 none
  五、在 input[type="radio"]:checked 的情況下,在它旁邊的 .tab-content display 才會變成可顯示的 block。


<div class="tabs">
  <!--   tab group -->
  <input type="radio" id="tab-1" name="tab" checked="checked">
  <label for="tab-1">Tab 1</label>
  <div class="tab-content">Content 1</div>
  <!--   tab group end -->
  <!--   tab group -->
  <input type="radio" name="tab" id="tab-2">
  <label for="tab-2">Tab 2</label>
  <div class="tab-content">Content 2</div>
  <!--   tab group end -->
  <!--   tab group -->
  <input type="radio" name="tab" id="tab-3">
  <label for="tab-3">Tab 3</label>
  <div class="tab-content">Content 3</div>
  <!--   tab group end -->


                .tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 5px;
  margin: 2em auto;
  max-width: 300px;
  width: 100%;

  input[type="radio"] {
    display: none;

    &:checked {
      + label {
        color: black;
        background-color: white;
        transform: translatey(1px);
        + .tab-content {
          display: block;

  label {
    padding: 0.5em 0.75em;
    color: #ccc;
    border: 1px solid #ccc;
    border-bottom: unset;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    cursor: pointer;
    order: 0;
      color: black;
  .tab-content {
    display: none;
    padding: 1em;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 5px;
    order: 1;