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 id="tabsContainer">
  <h1>Simple jQuery Tabs</h1>
  <header class="tabs-nav">
    <ul>
      <li class="active"><a href="#tab1">Tab One</a></li>
      <li><a href="#tab2">Tab Two</a></li>
      <li><a href="#tab3">Tab Three</a></li>
      <li><a href="#tab4">Tab Four</a></li>
    </ul>
  </header>

  <section class="tabs-content">
    <div id="tab1">
      <h3>This is tab 1</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium vel saepe optio, delectus excepturi rerum explicabo necessitatibus quae odio, quia placeat in doloribus eaque, quod sed quam reprehenderit perferendis impedit.</p>

      <p>Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum
        qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
    </div>

    <div id="tab2">
      <h3>Call of duty: Modern warfare 2</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Explicabo rem facere ut labore, debitis libero quam cumque natus officia repudiandae nemo laboriosam sint neque eos earum modi, vero odit laudantium.</p>
      <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia
        voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius
        modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.</p>
    </div>

    <div id="tab3">
      <h3>This is tab 3</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Commodi debitis sit, magni amet ipsum numquam eaque vero dolore cum ipsam doloremque deleniti eos! Maiores praesentium voluptates quos dolor commodi, expedita.</p>
    </div>

    <div id="tab4">
      <h3>This is tab 4</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas nobis eos, autem fugiat? Est laudantium obcaecati earum officia, quod quos et quis officiis. Odit consequatur cupiditate optio esse ipsa, eveniet.</p>
    </div>
  </section>
</div>
              
            
!

CSS

              
                body {
  font-family: 'Gudea', Arial, Helvetica, sans-serif;
  font-size: 14px;
  background: #e6e6e6
}

a {
  text-decoration: none;
}

/* Tabs Nav styles*/

#tabsContainer {
  padding: 20px;
}

.tabs-nav ul {
  margin: 0;
  padding: 0;
}

.tabs-nav li {
  display: inline-block;
  background: #34495E;
  border-width: 1px 1px 0 1px;
  border-style: solid;
  border-color: #34495E;
  margin-right: 5px;
}

.tabs-nav a {
  display: block;
  padding: 10px 15px;
  font-weight: bold;
  color: #fff;
}
/* Tabs Active state styles*/

.tabs-nav li.active {
  background: #FFF;
}

.tabs-nav li.active a {
  color: inherit;
}
/*Tabs Content styles*/

.tabs-content {
  border: 1px solid #34495E;
  padding: 10px;
  background: #FFF;
  margin-top: -1px;
  overflow: hidden;
}

.tabs-content IMG {
  margin-right: 10px;
}
/* Hide All the content divs EXCEPT the first one */

.tabs-content div:not(:first-child) {
  display: none;
}
              
            
!

JS

              
                $(function() {
  $('.tabs-nav a').click(function() {

    //Check if the tabs menu has active class
    $('.tabs-nav li').removeClass('active');
    $(this).parent().addClass('active');

    // Display active tab
    var currentTab = $(this).attr('href');
    $('.tabs-content div').hide();
    $(currentTab).show();

    return false;
  });
});
              
            
!
999px

Console