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="accord">
  <div id="accordion">
  <div class="accordionMainTitle">
    <span>FAQ</span>
  </div>
  <div id="panel-wrapper"> 
    <div class="panel active">
     <div class="acc-header">
     <span>Lorem Ipsum is simply dummy text</span>
      <i class="fa fa-chevron-down iconFixer"></i>
    </div>
    <div class="acc-body">
      <p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful.</p>
    </div>
  </div>
<div class="panel">
     <div class="acc-header">
     <span>Lorem Ipsum is simply dummy text</span>
      <i class="fa fa-chevron-down iconFixer"></i>
    </div>
    <div class="acc-body">
      <p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful.</p>
    </div>
  </div>
<div class="panel">
     <div class="acc-header">
    <span class="acc-header-title">Lorem Ipsum is simply dummy text</span>
      <i class="fa fa-chevron-down iconFixer"></i>
    </div>
    <div class="acc-body">
      <p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful.</p>
    </div>
  </div>
   </div>
   
</div>

              
            
!

CSS

              
                .panel {
  padding: 20px;
  
}
.accordionMainTitle {
  background:#c1e3ff;
  border: 2px solid #ddd;
  border-radius: 10px 10px 0 0;
  padding: 20px 35px;
  font-family: 'Raleway', sans-serif;
  font-size: 25px;
}

.acc-header {
  cursor: pointer;
  padding: 25px;
  color: #397BB5;
  border-radius: 10px;
  font-weight: bold;
  background-color: #FAFAFA;
  display: block;
  font-family: 'Raleway', sans-serif;
  margin-bottom:0px;
  border-bottom: none !important;
}


.acc-body {
    padding: 20px;
    line-height: 1.9;
    background-color: #FAFAFA;
    border-radius: 0 0 10px 10px;
    font-family: 'Raleway', sans-serif;
}
#accordion .acc-body{
   display : none;
}

#accordion .active .acc-body {
   display : block;
}

#panel-wrapper {
  border: 2px solid #DDD;
  border-top: none;
  border-radius: 0 0 10px 10px;
  display: block;
}
.iconFixer {
  float: right;
}
.acc-header:hover{
  background-color: #397BB5 !important;
  color: white !important;
}

.panel:hover .acc-header {
    background-color: #397BB5 !important;
    color: white !important;
    
}

              
            
!

JS

              
                function initAccordion(accordionElem){
  
  //when panel is clicked, handlePanelClick is called.           
  function handlePanelClick(event){
      showPanel(event.currentTarget);
  }
//Hide currentPanel and show new panel.  
  
  function showPanel(panel){
    //Hide current one. First time it will be null. 
     var expandedPanel = accordionElem.querySelector(".active");
     if (expandedPanel){
         expandedPanel.classList.remove("active");
     }
     //Show new one
     panel.classList.add("active");
     
  }
  var allPanelElems = accordionElem.querySelectorAll(".panel");
  for (var i = 0, len = allPanelElems.length; i < len; i++){
       allPanelElems[i].addEventListener("click", handlePanelClick);
  }
  //By Default Show first panel
  showPanel(allPanelElems[-1])
}
initAccordion(document.getElementById("accordion"));

var accordionHeader = document.g


              
            
!
999px

Console