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

              
                <nav id="accordion-tabs">
  <div class="accordion-tab">
    <div class="accordion-inner">
      <div class="row row-collapse">
      <div class="col-md-12 col-lg-6">
        <a href="#" class="accordion-toggle">Service</a>
        <div class="accordion-content">
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam metus nisl, scelerisque a aliquam vel, volutpat ut odio. Donec vulputate quam in scelerisque tempor.   </p>
        </div>
      </div>
      <div class="col-md-12 col-lg-6">
        <div class="accordion-content">
          <ul>
            <li>Test</li>
            <li>Test</li>
            <li>Test</li>
          </ul>
        </div>
      </div>
    </div>
    </div>
    </div>
  <div class="accordion-tab">
    <div class="accordion-inner">
      <div class="row row-collapse">
      <div class="col-md-12 col-lg-6">
        <a href="#" class="accordion-toggle">Service</a>
        <div class="accordion-content">
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam metus nisl, scelerisque a aliquam vel, volutpat ut odio. Donec vulputate quam in scelerisque tempor.   </p>
        </div>
      </div>
      <div class="col-md-12 col-lg-6">
        <div class="accordion-content">
          <ul>
            <li>Test</li>
            <li>Test</li>
            <li>Test</li>
          </ul>
        </div>
      </div>
    </div>
    </div>
  </div>
  <div class="accordion-tab">
    <div class="accordion-inner">
      <div class="row row-collapse">
      <div class="col-md-12 col-lg-6">
        <a href="#" class="accordion-toggle">Service</a>
        <div class="accordion-content">
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam metus nisl, scelerisque a aliquam vel, volutpat ut odio. Donec vulputate quam in scelerisque tempor.   </p>
        </div>
      </div>
      <div class="col-md-12 col-lg-6">
        <div class="accordion-content">
          <ul>
            <li>Test</li>
            <li>Test</li>
            <li>Test</li>
          </ul>
        </div>
      </div>
    </div>
    </div>
  </div>
</nav>
              
            
!

CSS

              
                // Global
*{
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  box-sizing: border-box;
}

body{
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100vh;
  font-family: 'Arial', sans-serif;
}

// Utilities
.row-collapse{
  margin-left: 0 !important;
  margin-right: 0 !important;
  [class*="col-"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

// Accordion tabs
#accordion-tabs{
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: 100%;
  .accordion-tab{
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: flex-grow .5s ease-in-out;
    &:hover, &:focus, &:active{
      text-decoration: none;
    }
    .accordion-inner{
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      padding: 3rem;
    }
    .accordion-content{
      opacity: 0;
      color: white;
      transition: opacity .8s;
    }
    .accordion-toggle{
      padding-right: 60px;
      font-size: 50px;
      text-transform: uppercase;
      font-weight: bold;
      cursor: pointer;
      color: white;
      display: block;
      &:hover, &:focus, &:active{
        text-decoration: none;
      }
      span{
        display: inline-block;
      }
      &:after{
        display: inline-block;
        height: 40px;
        width: 40px;
        line-height: 40px;
        text-align: center;
        content: "+";
      }
    }
    &:nth-of-type(1){
      background: coral;
    }
    &:nth-of-type(2){
      background: darkcyan;
    }
    &:nth-of-type(3){
      background: lightgreen;
    }
    &.open{
      flex: 4 0 auto;
      .accordion-content{
        opacity: 1;
      }
      .accordion-toggle{
        &:after{
          content: "-";
        }
      }
    }
  }
}
              
            
!

JS

              
                // Variables
var accToggles = document.getElementsByClassName('accordion-toggle');

// Tab click
var tabClick = function(el){
  
  // Clicked toggles tab parent
  var targetParent = el.target.closest('.accordion-tab');
  
  Array.prototype.forEach.call(accToggles, function(tog){
    
    // Each toggles tab parent
    var tabParent = tog.closest('.accordion-tab');
    
    if (tabParent != targetParent){
      tabParent.classList.remove('open');
    } else {
      targetParent.classList.toggle('open');
    }
    
  });
};

// Attach click handler
Array.prototype.forEach.call(accToggles, function(tog, index) {
  tog.addEventListener('click', tabClick, false);
});
              
            
!
999px

Console