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="tab-example">
  <h1>TAB - HORIZONTAL</h1>
  <ul class="tabs tabs-horizontal">
    <li>
      <input type="radio" id="tab-1" name="tab-h" checked>
      <label class="tab-label tab-label-horizontal" for="tab-1">Tab 1</label>
      <div id="tab-content-1 tab-content-horizontal">
        <p>Praesent venenatis ultrices sapien nec aliquam. Aenean gravida nunc lacinia quam semper, sit amet sodales elit consequat. Suspendisse volutpat, lacus finibus vulputate tincidunt, dui ipsum laoreet nulla, sed ultrices lectus orci vel lacus. Pellentesque vitae lobortis orci. Ut vel tortor urna. Maecenas leo dolor, maximus accumsan convallis sed, dapibus vel metus. Pellentesque vitae neque porttitor, consequat ipsum eu, malesuada ante.</p>
      </div>
    </li>
    <li>
      <input type="radio" id="tab-2" name="tab-h">
      <label class="tab-label tab-label-horizontal" for="tab-2">Tab 2</label>
      <div id="tab-content-2 tab-content-horizontal">
        <p>Morbi blandit metus sit amet ipsum blandit tincidunt. Sed semper pharetra ultricies. Proin sem urna, congue non ligula eget, vestibulum ullamcorper ipsum. Vivamus ipsum justo, egestas eget sapien in, mattis luctus augue. Curabitur aliquet eros eu aliquet accumsan. Aenean eget orci eleifend ligula lacinia fermentum. Nulla quis porttitor ex. Donec eleifend eros ut pharetra blandit.</p>
      </div>
    </li>
    <li>
      <input type="radio" id="tab-3" name="tab-h">
      <label class="tab-label tab-label-horizontal" for="tab-3">Tab 3</label>
      <div id="tab-content-3 tab-content-horizontal">
        <p>Proin dapibus euismod arcu eget tempor. Proin eget porttitor est. Pellentesque mollis viverra nunc, vitae congue metus facilisis id. Ut elementum a ex a ultricies. Sed faucibus dolor a tortor porta congue. In quis rutrum enim, id tempus turpis. Phasellus risus orci, pharetra id dui ut, porta aliquam est. Curabitur ex leo, bibendum quis dolor sit amet, placerat mattis diam. Nulla ac malesuada justo. Vestibulum dictum aliquet augue. Donec vitae ultricies ipsum. Curabitur egestas nec dolor a tincidunt. Proin ac ligula vulputate, consequat neque ac, efficitur lacus. Etiam et consequat nisi, eget placerat nulla.</p>
      </div>
    </li>
  </ul>
</div>

<div class="tab-example">
  <h1>TAB - VERTICAL</h1>
  <ul class="tabs tabs-vertical">
    <li>
      <input type="radio" id="tab-4" name="tab-v" checked>
      <label class="tab-label tab-label-vertical" for="tab-4">Tab 4</label>
      <div id="tab-content-4 tab-content-vertical">
        <p>Praesent venenatis ultrices sapien nec aliquam. Aenean gravida nunc lacinia quam semper, sit amet sodales elit consequat. Suspendisse volutpat, lacus finibus vulputate tincidunt, dui ipsum laoreet nulla, sed ultrices lectus orci vel lacus. Pellentesque vitae lobortis orci. Ut vel tortor urna. Maecenas leo dolor, maximus accumsan convallis sed, dapibus vel metus. Pellentesque vitae neque porttitor, consequat ipsum eu, malesuada ante.</p>
      </div>
    </li>
    <li>
      <input type="radio" id="tab-5" name="tab-v">
      <label class="tab-label tab-label-vertical" for="tab-5">Tab 5</label>
      <div id="tab-content-5 tab-content-vertical">
        <p>Morbi blandit metus sit amet ipsum blandit tincidunt. Sed semper pharetra ultricies. Proin sem urna, congue non ligula eget, vestibulum ullamcorper ipsum. Vivamus ipsum justo, egestas eget sapien in, mattis luctus augue. Curabitur aliquet eros eu aliquet accumsan. Aenean eget orci eleifend ligula lacinia fermentum. Nulla quis porttitor ex. Donec eleifend eros ut pharetra blandit.</p>
      </div>
    </li>
    <li>
      <input type="radio" id="tab-6" name="tab-v">
      <label class="tab-label tab-label-vertical" for="tab-6">Tab 6</label>
      <div id="tab-content-6 tab-content-vertical">
        <p>Proin dapibus euismod arcu eget tempor. Proin eget porttitor est. Pellentesque mollis viverra nunc, vitae congue metus facilisis id. Ut elementum a ex a ultricies. Sed faucibus dolor a tortor porta congue. In quis rutrum enim, id tempus turpis. Phasellus risus orci, pharetra id dui ut, porta aliquam est. Curabitur ex leo, bibendum quis dolor sit amet, placerat mattis diam. Nulla ac malesuada justo. Vestibulum dictum aliquet augue. Donec vitae ultricies ipsum. Curabitur egestas nec dolor a tincidunt. Proin ac ligula vulputate, consequat neque ac, efficitur lacus. Etiam et consequat nisi, eget placerat nulla.</p>
      </div>
    </li>
  </ul>
</div>
              
            
!

CSS

              
                * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.tab-example {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 50px;
  background: #fc6;
}

h1 {
  margin-bottom: 10px;
}

.tabs {
  display: flex;
  justify-content: flex-start; /* position of the tab */
  align-items: stretch; /* for <li> to occupy the full height (horizontal) / width (vertical) */
  position: relative;
  list-style: none;
  width: 100%;
  min-height: 200px; /* height of the tab area */
  color: #fff;
}

.tabs-horizontal {
  flex-direction: row;
}

.tabs-vertical {
  flex-direction: column;
}

[type="radio"] {
  display: none; /* hide the radio button */
}

.tab-label {
  display: inline-block;
  padding: 5px 10px;
  text-align: center;
  cursor: pointer;
  background: #9cf;
  white-space: nowrap; /* prevent label from wrapping */
}

.tab-label-horizontal {
  width: 80px;
  height: 15%;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
}

.tab-label-vertical {
  width: 10%;
  height: 30px;
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
}

.tab-label:hover {
  background: #39f;
}

.tab-label:active {
  background: #fff;
  color: #06f;
}

[id^="tab-content-"] {
  display: none; /* hide the content of all tabs (not selected) */
  padding: 5px 10px;
  background: #06f;
  width: 100%;
  height: 100%;
  overflow: scroll; /* able to scroll to see all content */
}

[id*="tab-content-horizontal"] {
  position: absolute; /* layout as the content area for all tabs */
  top: 15%; /* height of label */
  left: 0; /* relative to <ul>, independent of how <li> is positioned */
  height: 85%; /* adjust according to height of label */
}

[id*="tab-content-vertical"] {
  position: absolute; /* layout as the content area for all tabs */
  top: 0;
  left: 10%; /* width of label */
  width: 90%; /* adjust according to width of label */
}

[type="radio"]:checked + label {
  background: #06f;
}

[type="radio"]:checked ~ [id^="tab-content-"] {
  display: block; /* display the content of selected tab */
}

@media only screen and (max-width: 425px) {
  .tabs {
    display: block;
  }

  .tab-label {
    width: 100%;
    border-radius: 0;
    border: 1px solid #006;
  }

  [id^="tab-content-"] {
    position: static;
    width: 100%;
    border: 1px solid #006;
    border-top: none;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console