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

              
                <ul class="whiskey-tabs">
  <li><a href="#tab-one" class="is-active">Tab one</a></li>
  <li><a href="#tab-two">Tab two</a></li>
  <li><a href="#tab-three">Tab three</a></li>
</ul>
<section class="whiskey-tab-content" id="tab-one">
  <h1>Tab one content</h1>
  <p>Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Aenean lacinia bibendum nulla sed consectetur. Sed posuere consectetur est at lobortis. Maecenas sed diam eget risus varius blandit sit amet non magna. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
</section>
<section class="whiskey-tab-content" id="tab-two">
  <h1>Tab two content</h1>
  <p>Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Curabitur blandit tempus porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed odio dui. Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis euismod semper.</p>
</section>
<section class="whiskey-tab-content" id="tab-three">
  <h1>Tab three content</h1>
  <p>Nulla vitae elit libero, a pharetra augue. Curabitur blandit tempus porttitor. Nullam quis risus eget urna mollis ornare vel eu leo. Donec id elit non mi porta gravida at eget metus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed posuere consectetur est at lobortis.</p>
</section>

<h3>Read more here - <a href="https://getbutterfly.com/pure-javascript-tabbing-functionality-with-linkable-tabs/">Pure JavaScript tabbing functionality with linkable tabs</a></h3>
              
            
!

CSS

              
                body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  font-size: 14px;
  line-height: 1.5;
  color: #24292e;
  background-color: #fff;
}

.whiskey-tabs {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
}
.whiskey-tabs:after {
  clear: both;
  content: '';
  display: block;
}
.whiskey-tabs li {
  float: left;
  margin-right: 1px;
}
.whiskey-tabs li a {
  background-color: #34495E;
  color: #ECF0F1;
  display: inline-block;
  padding: 12px 16px;
  text-decoration: none;
}
.whiskey-tabs li a:hover {
  background-color: #2C3E50;
  text-decoration: none;
}
.whiskey-tabs li a.is-active {
  background-color: #2C3E50;
  text-decoration: none;
}
.whiskey-tabs + .whiskey-tab-content {
  display: block;
}

.whiskey-tab-content {
  border: 1px solid #34495E;
  display: none;
  padding: 0 8px;
}
html.no-js .whiskey-tab-content {
  display: block;
}

              
            
!

JS

              
                var tabLinks = document.querySelectorAll('.whiskey-tabs li a');

for (var i = 0; i < tabLinks.length; i++) { 
  tabLinks[i].onclick = function() {
    var target = this.getAttribute('href').replace('#', '');
    var sections = document.querySelectorAll('.whiskey-tab-content');
    
    for(var j=0; j < sections.length; j++) {
      sections[j].style.display = 'none';
    }
    
    document.getElementById(target).style.display = 'block';
    
    for(var k=0; k < tabLinks.length; k++) {
      tabLinks[k].removeAttribute('class');
    }
    
    this.setAttribute('class', 'is-active');
    
    return false;
  }
};

// Enable link to tab
var hash = document.location.hash;
if (hash) {
  document.querySelectorAll('.whiskey-tabs li a[href="' + hash + '"]')[0].click();
}

              
            
!
999px

Console