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="accordion">
    <button class="accordion-btn"> <span>Cash Offers</span></button>
    <div class="panel">
        <button class="accordion-btn inner-accord"><span>Subscription</span></button>
        <div class="panel">
            <div class="content1"><input type="checkbox">Subscription</div>
        </div>
        <button class="accordion-btn inner-accord"><span>Auto Publish</span></button>
        <div class="panel">
            <div class="content1"><input type="checkbox">Cash Offers</div>
            <div class="content1"><input type="checkbox">Conditional Cash Offers</div>
            <div class="content1"><input type="checkbox">Cash Rebates</div>
            <div class="content1"><input type="checkbox">Conditional Cash Rebates</div>
            <div class="content1"><input type="checkbox">Formula Pricing Cash Offers</div>
        </div>
        
    </div>
    <!-- panel -->
</div>

<div class="accordion">
    <button class="accordion-btn"><span>APR Offers</span></button>
    <div class="panel">
        <div class="content"><input type="checkbox">Subscription</div>
        <button class="accordion-btn inner-accord"><span>Auto Publish</span></button>
        <div class="panel">
            <div class="content1"><input type="checkbox">APR Offers</div>
            <div class="content1"><input type="checkbox">Conditional APR Offers</div>
            <div class="content1"><input type="checkbox">APR Rebates</div>
            <div class="content1"><input type="checkbox">Conditional APR Rebates</div>
                    <div class="content1"><input type="checkbox">Formula Pricing APR Rebates</div>
        </div>
    </div>
    <!-- panel -->
</div>
<div class="accordion">
    <button class="accordion-btn"><span>LEASE Offers</span></button>
    <div class="panel">
        <div class="content"><input type="checkbox">Subscription</div>
        <button class="accordion-btn inner-accord"><span>Auto Publish</span></button>
        <div class="panel">
            <div class="content1"><input type="checkbox">Lease Offers</div>
            <div class="content1"><input type="checkbox">Lease Rebates</div>
        </div>
    </div>
    <!-- panel -->
</div>

              
            
!

CSS

              
                .accordion .content{
    padding: .5em 1.5em .5em;
}
.content1{
    padding: .5em 5em .5em;
}

$dark-blue: #2C3E50;
$dark-blue-highlight: #3f5973;
$pink:  #e01f32;
$off-white: #ECF0F1;
$baby-blue: #3498DB;
$blue: #5b80a4;
$blue-highlight: #7b99b7;

$color-main       : $off-white;
$color-background : $off-white;
$color-headlines  : $dark-blue;

@import 'https://fonts.googleapis.com/css?family=Montserrat';

$font-main: 'Montserrat', Helvetica, sans-serif;

* {
    font-size: 16px;
    font-family: $font-main;
}

/* Accordion Styles */
.accordion {
    width: 60%;
    margin: 0 auto;
    border: 1px solid $off-white;
}

/* Button Styles */
.accordion-btn {
    background-color: $color-headlines;
    font-size: 1.5em;
    color: $color-main;
    cursor: pointer;    
    width: 100%;
    text-align: left;
    border: none;
    transition: 0.5s;    
}

.accordion-btn span{
    padding-left:.5em;
}

.accordion-btn:after {
    content: '+';
    font-size: 1em;
    color: $off-white;
    float: left;
    margin-left: 2px;
}

/* Active and Hover Button Styles */
.accordion-btn.active,
.accordion-btn:hover {
    background-color: $dark-blue-highlight;
}

.accordion-btn.active:after {
    content: "-";
}

/* Panel Styles */
.panel {
    background-color: $off-white;
    max-height: 0;
    overflow: hidden;
    transition: 0.5s ease-in-out;
    opacity: 0;
}

.panel p {
    font-size: 1.2em;
    padding: 0 2em;
}

/* Show Panel onclick */
.panel.show {
    display: block;
    opacity: 1;
    max-height: 500px;
}

/* Inner Accordion Style */
.inner-accord {
    background-color: $blue;
    font-size: 1.2em;
    margin-left: 1.25em;
}

.inner-accord.active,
.inner-accord:hover {
    background-color: $blue-highlight;
}
              
            
!

JS

              
                // Toggle 'active' and 'show' states of panels

var accord = document.getElementsByClassName("accordion-btn");
var i;

for (i = 0; i < accord.length; i++) {
    accord[i].onclick = function() {
        this.classList.toggle("active");
        this.nextElementSibling.classList.toggle("show");
    }
}
              
            
!
999px

Console