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 class="container ">
  <div class="row mt-3">
  <div class="col">
  
  <nav>
  <ul class="nav nav-tabs" role="tablist">
    <li class="nav-item"><a href="#" id="tab1" class="nav-link active" data-bs-toggle="tab" data-bs-target="#page1" type="button" role="tab" aria-controls="page1" aria-selected="true">One One-Thousand</a></li>
    <li class="nav-item"><a href="#" id="tab2" class="nav-link" data-bs-toggle="tab" data-bs-target="#page2" type="button" role="tab" aria-controls="page2" aria-selected="false">Two One-Thousand</a></li>
    <li class="nav-item"><a href="#" id="tab3" class="nav-link" data-bs-toggle="tab" data-bs-target="#page3" type="button" role="tab" aria-controls="page3" aria-selected="false">Three to Get Ready</a></li>
    <li class="nav-item"><a href="#" id="tab4" class="nav-link" data-bs-toggle="tab" data-bs-target="#page4" type="button" role="tab" aria-controls="page4" aria-selected="false">Four to Go</a></li>
    <li class="nav-item"><a href="#" id="tab5" class="nav-link" data-bs-toggle="tab" data-bs-target="#page5" type="button" role="tab" aria-controls="page5" aria-selected="false">Five to Something Else</a></li>
    <li class="nav-item"><a href="#" href="#" id="tab6" class="nav-link" data-bs-toggle="tab" data-bs-target="#page6" type="button" role="tab" aria-controls="page6" aria-selected="false"> Six</a></li>
  
    <div id="nav-buttons" class="pull-right">
      <div id="tabDropdown" class="btn-group btn-group-sm">
       <div id="tabDrop" class="nav-link dropdown-toggle" type="button" id="dropdownMenu" data-bs-toggle="dropdown">
        <i class="bi bi-list"></i>
       </div>
       <ul class="dropdown-menu">
         <li><a href="javascript:void(0)" class="dropdown-item" data-bs-toggle="tab" data-bs-target="#page1">One One-Thousand</a></li>
         <li><a href="javascript:void(0)" class="dropdown-item" data-bs-toggle="tab" data-bs-target="#page2">Two One-Thousand</a></li>
         <li><a href="javascript:void(0)" class="dropdown-item" data-bs-toggle="tab" data-bs-target="#page3">Three to Get Ready</a></li>
         <li><a href="javascript:void(0)" class="dropdown-item" data-bs-toggle="tab" data-bs-target="#page4">Four to Go</a></li>
         <li><a href="javascript:void(0)" class="dropdown-item" data-bs-toggle="tab" data-bs-target="#page5">Five to Something Else</a></li>
         <li><a href="javascript:void(0)" class="dropdown-item" data-bs-toggle="tab" data-bs-target="#page6">Six</a></li>
       </ul>
     </div>   
   </div>
    
  </ul>
  </nav>
    
  <div class="tab-content mt-3 pt-3" >
    <div id="page1" class="tab-pane fade show active" role="tabpanel" aria-labelledby="tab1" tabindex="0" >
      <h1 class="text-center" >First we have 1</h1>
    </div>
    <div id="page2" class="tab-pane fade" role="tabpanel" aria-labelledby="tab2" tabindex="0" >
      <h1 class="text-center" >There was 2</h1>
    </div>
    <div id="page3" class="tab-pane fade" role="tabpanel" aria-labelledby="tab3" tabindex="0" >
      <h1 class="text-center" >Content of 3</h1>
    </div>
    <div id="page4" class="tab-pane fade" role="tabpanel" aria-labelledby="tab4" tabindex="0" >
      <h1 class="text-center" >4</h1>
    </div>
    <div id="page5" class="tab-pane fade" role="tabpanel" aria-labelledby="tab5" tabindex="0" >
      <h1 class="text-center" >5</h1>
    </div>
    <div id="page6" class="tab-pane fade" role="tabpanel" aria-labelledby="tab6" tabindex="0" >
      <h1 class="text-center" >6</h1>
    </div>
  </div>

  </div>
</div>
  
</div>





              
            
!

CSS

              
                


              
            
!

JS

              
                window.onresize = function(event) {
    CheckTabSize();
};

$('.nav-tabs li').click(function() {
    setTimeout(SetActiveTabsYourself, 10);
});

var ShownTabs = '.nav-tabs .nav-item[style!="display: none;"]';
var HiddenTabs = '.nav-tabs .nav-item[style*="display: none;"]';
function CheckTabSize() {
      //Get Tab Area
    var buttonWidth = $('#nav-buttons').width();
    var tabAreaWidth = $('.nav-tabs').width() - buttonWidth;
    var tabWidths = 0;
    var firstHidden;
  
    //Add Up the Tabs' Widths
    $.each($(ShownTabs), function(idx, obj){
      tabWidths += $(obj).outerWidth(); //padding
    });
  
    //Find out which ones to hide
    while(tabWidths > tabAreaWidth) {
      var hider = $(ShownTabs).last();
      tabWidths -= $(hider).outerWidth();
      $(hider).hide();
    }
  
    //See if we can show any
    firstHidden = $(HiddenTabs).first();
    while(firstHidden.length > 0 && (tabWidths + firstHidden.width()) < tabAreaWidth) {
      tabWidths += $(firstHidden).outerWidth();
      $(firstHidden).show();
      firstHidden = $(HiddenTabs).first();
    }
  
    //Affect drop-down button
    if ($(HiddenTabs).length === 0) {
      $('#tabDrop').hide();
    } else {
      $('#tabDrop').show();
    }
  
    //Hide drop-down tabs as necessary
    var shown = $(ShownTabs);
  
    $.each($('#tabDropdown li'), function(idx, obj){
        var isInShown = $.grep(shown, function(el){ return $(el).find('a').data('bs-target') == $(obj).find('a').data('bs-target'); }).length > 0;
        if (isInShown) {
            $(obj).hide();
        } else {
            $(obj).show();
        }
    });
}
function SetActiveTabsYourself() {    
    $('.nav-tabs li').removeClass('active');
    var activeTab = $('.tab-pane .active');
    if (activeTab.length > 0) {
        var activeID = $(activeTab[0]).attr('id');
        $('.nav-tabs li a[data-bs-target=#' + activeID + ']').parent().addClass('active');
    }
}

setTimeout(CheckTabSize, 100);
setTimeout(SetActiveTabsYourself, 100);



              
            
!
999px

Console