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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <ul class="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="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="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="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>
              
            
!

CSS

              
                @import "compass/css3";

body {
  font: 13px/150% Helvetica, Arial, sans-serif;
}

$grey: rgb(230, 230, 230);

ul.tabs {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  &:after {
    clear: both;
    content: '';
    display: block;
  }
  li {
    float: left;
    margin-right: 5px;
    a {
      @include background-image(linear-gradient(top, $grey, darken($grey, 10%)));
      @include border-radius(5px 5px 0 0);
      color: rgb(0, 0, 0);
      display: inline-block;
      padding: 10px;
      text-decoration: none;
      &:hover {
        text-decoration: underline;
      }
      &.is-active {
        margin-bottom: -2px;
        text-decoration: underline;
        padding-bottom: 12px;
      }
    }
  }
  + section.tab-content {
    display: block;
  }
}

section.tab-content {
  border: 2px solid rgb(0, 0, 0);
  display: none;
  padding: 0 8px;
  html.no-js & {
    display: block;
  }
}
              
            
!

JS

              
                var tabLinks = document.querySelectorAll('ul.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('section.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;
  }
};
              
            
!
999px

Console