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

              
                <div class="con">
  <button class="accordion">Country Research</button>
<div class="panel">
  <p>Consumer research forms the foundation of many marketing departments. Spire offers both quantitative and qualitative research techniques across all emerging market countries, which we cover.</p>
</div>

<button class="accordion odd">Customer Decision Dynamic Analysis</button>
<div class="panel">
  <p>Customer purchase decisions are complex. Spire assists companies in deciphering business-to-business and business-to-consumer purchase decision dynamics.</p>
</div>

<button class="accordion">Market Environment Research</button>
<div class="panel">
  <p>Whether your company is seeking to grow market share, launch an innovation or enter a new market, Spire offers comprehensive solutions to bring your organisation to greater heights.</p>
</div>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Ubuntu:400,500,700');
.con{
  padding:2em;
  max-width:980px;
  margin:0px auto;
  font-family:'Ubuntu';
  font-size:15px;
}
button.accordion {
    background-color: #eda712;
    color: #444;
    cursor: pointer;
    padding: 18px;
    width: 100%;
    text-align: left;
    border: none;
    outline: none;
    transition: 0.4s;
    font-weight:700;
    color:#fff;
    font-size:16px;
    padding: 1.2em;
    font-size: 18px;
    padding: 0.9em 1.2em;
    font-weight:500; 
  &.active, &:hover {
    background-color:darken(#eda712,10%);
  }
}
button.accordion.odd {
    background-color: #999;
  &.active, &:hover {
    background-color:darken(#999,10%);
  }
}
button.accordion:after {
    content: '\02795'; /* Unicode character for "plus" sign (+) */
    font-size: 13px;
    color: #777;
    float: right;
    margin-left: 5px;
}

button.accordion.active:after {
    content: "\2796"; /* Unicode character for "minus" sign (-) */
}

/* Add a background color to the button if it is clicked on (add the .active class with JS), and when you move the mouse over it (hover) */

/* Style the accordion panel. Note: hidden by default */
div.panel {
    padding: 1em 18px;
    background-color: white;
    display: none;
    line-height:1.44em;
}
              
            
!

JS

              
                var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
    acc[i].onclick = function(){
        /* Toggle between adding and removing the "active" class,
        to highlight the button that controls the panel */
        this.classList.toggle("active");

        /* Toggle between hiding and showing the active panel */
        var panel = this.nextElementSibling;
        if (panel.style.display === "block") {
            panel.style.display = "none";
        } else {
            panel.style.display = "block";
        }
    }
}
              
            
!
999px

Console