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

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="container">
 
    <ul class="tabs">
      <li class="current" rel="tab1">Tab 1</li>
      <li rel="tab2">Tab 2</li>
      <li rel="tab3">Tab 2</li>
    </ul>
 
   
    <div id="tab1" class="tab-container">
      
      <p>1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed egestas felis. Etiam pellentesque auctor mi, a vestibulum elit sodales in. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec eget sollicitudin purus. Nam bibendum eget dolor eu viverra. Nulla tempor ante quis venenatis maximus. </p>
    </div>
    <div id="tab2" class="tab-container ">
      
      <p>2. Suspendisse in velit nibh. Vivamus in metus laoreet, feugiat neque in, tincidunt dolor. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum commodo, velit eu malesuada malesuada.</p>
    </div>
  
    <div id="tab3" class="tab-container">
      
      <p>3. Suspendisse in velit nibh. Vivamus in metus laoreet, feugiat neque in, tincidunt dolor. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum commodo, velit eu malesuada malesuada.</p>
    </div>
   
</div>
              
            
!

CSS

              
                .container {
  width: 90%;
  max-width: 500px;
  margin: auto;
}

ul.tabs {
  margin: 0;
  padding: 0 0 12px 0;
  li {
    border: solid 1px #ccc;
    transition: all 0.3s ease-in-out;
    display: inline-block;
    padding: 10px 20px;
    cursor: pointer;
    &.current {
      background-color: #ccc;
    }
  }
}
 
.tab-container:not(.current){
  display: none;
   
}
              
            
!

JS

              
                $(".tab-container:first").addClass("current");

$(".tabs li").click(function () {
  $(".tab-container").hide().removeClass("current");
  var activeTab = $(this).attr("rel");
  $("#" + activeTab)
    .fadeIn(1000)
    .addClass("current");

  $(".tabs li").removeClass("current");
  $(this).addClass("current");
});

              
            
!
999px

Console