Pen Settings



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


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


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.


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.



  <div id="container">

    <ul class="tabs">
      <li><a href="" data-append="#seo" data-current>SEO</a></li>
      <li><a href="" data-append="#web">Web</a></li>
      <li><a href="" data-append="#ppc">PPC</a></li>

    <div class="content" id="seo">
      SEO Content




                ul {display:flex; margin:0 0 20px 0; padding:0; gap:10px;}
li {list-style:none; border:1px solid #000; padding:10px; }


                $('body').on('click','a[data-replace], [data-replace] a, a[data-append]', function(ev){


  // get clicked element
  var clicked = $(this);

  // get destination url
  var destination = $(clicked).attr('href');

  // determine if replacing or appending
  var state = ($(clicked)[0].hasAttribute('data-append') || $(clicked).closest('[data-append]').length > 0) ? 'append' : 'replace';

  // get id of content to append
  var id = ($(clicked)[0].hasAttribute('data-append') || $(clicked).closest('[data-append]').length > 0) ? $(clicked).data('append') : null;
  // get previous 'current' tab
  var tabs = $(clicked).closest('.tabs');
  var previous_current = $(tabs).find('[data-current]');

  // if requested content doesn't exist, then continue to AJAX request
  if($(id).length == 0){

    // disable function on double click
    if(!{ = true;

      // get # of destination_container
      var destination_container = ($(clicked).data(state)) ? $(clicked).data(state) : $(clicked).closest('[data-' + state + ']').data(state);

      // AJAX request
      $.get(destination, function(data){
        // replace content
        if(state == 'replace'){

          // filter to required html
          var new_html = $(data).filter(destination_container).html();

          // replace container with new html

          // append content
        }else if(state == 'append'){

          // filter to required html
          var new_html = $(data).find(destination_container)[0].outerHTML;

          // append container with new html
          $('#' + $(data).find(destination_container).parent().attr('id')).append(new_html);

          // update tab state here (if required)


        // reset click = false;



    // if content already appended
  }else if(state == 'append'){

    // show this content

    // update tab state here (if required)



function updateTabContent(previous_current,clicked){

  // hide previous current child

  // update current tab

  // if has tab mobile view
  if($(clicked).closest('.tabs--mobile').length > 0){
    var toggle = $(clicked).closest('.tabs--mobile').prev('.tabs--mobile-toggle');
    // update tab mobile
    // close tab mobile