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 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.

Details

Privacy

Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO

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.

Template

Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.

Template URL

Any Pen can act as a template (even if you don't flip the toggle above) with a special URL you can use yourself or share with others. Here's this Pen's template URL:

Screenshot

Screenshot or Custom Thumbnail

Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO

HTML

              
                <div class="faq-dropdown-btn faq-dropdown"> 
  <select id="faqDrodpown">
     <option value="red">Red</option>
     <option value="yellow">Yellow</option>
     <option value="blue">Blue</option>
  </select>
</div>

<div class="output">
  <div id="red" class="faqs">
    <div id="accordion-faq">
    <h4 class="accordionfaq-toggle"><span class="arrow">Lorem ipsum title</span></h4>
  <div class="accordionfaq-content">Lorem ipsum content</div>
    <h4 class="accordionfaq-toggle"><span class="arrow">Lorem ipsum title</span></h4>
  <div class="accordionfaq-content">Lorem ipsum content</div>
  </div>
  </div>
  <div id="yellow" class="faqs"><div id="accordion-faq">
    <h4 class="accordionfaq-toggle"><span class="arrow">Lorem ipsum title</span></h4>
  <div class="accordionfaq-content">Lorem ipsum content</div>
    <h4 class="accordionfaq-toggle"><span class="arrow">Lorem ipsum title</span></h4>
  <div class="accordionfaq-content">Lorem ipsum content</div>
    </div>
  </div>
  <div id="blue" class="faqs">
  <div id="accordion-faq">
    <h4 class="accordionfaq-toggle"><span class="arrow">Lorem ipsum title</span></h4>
  <div class="accordionfaq-content">Lorem ipsum content</div>
    <h4 class="accordionfaq-toggle"><span class="arrow">Lorem ipsum title</span></h4>
  <div class="accordionfaq-content">Lorem ipsum content</div>
    <h4 class="accordionfaq-toggle"><span class="arrow">Lorem ipsum title</span></h4>
  <div class="accordionfaq-content">Lorem ipsum content</div>
  </div>
  </div>
</div>
              
            
!

CSS

              
                
.faq-dropdown {
  position: relative;
  display:block;
  margin-top:0.5em;
  padding:0;
}
.faq-dropdown select {
  width:100%;
  margin:0;
  background:none;
  border: 1px solid transparent;
  outline: none;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  font-size:1.25em;
  color: #444;
  padding: .6em 1.9em .5em .8em;
  line-height:1.3;
}

.faq-dropdown::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 8px;
  top: 50%;
  right: 1em;
  margin-top:-4px;
  z-index: 2;
  background: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 12'%3E%3Cpolygon fill='rgb(102,102,102)' points='8,12 0,0 16,0'/%3E%3C/svg%3E") 0 0 no-repeat;  
  pointer-events:none;
}

/* This hides native dropdown button arrow in IE 10/11+ so it will have the custom appearance, IE 9 and earlier get a native select */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  .faq-dropdown select::-ms-expand {
    display: none;
  }
  /* Removes the odd blue bg color behind the text in IE 10/11 and sets the text to match the focus style text */
  select:focus::-ms-value {
    background: transparent;
    color: #222;
  }
}

/* Firefox 7+ -- Will let us hide the arrow, but inconsistently (see FF 30 comment below). We've found the simplest way to hide the native styling in FF is to make the select bigger than its container. */
/* The specific FF selector used below successfully overrides the previous rule that turns off the custom icon; other FF hacky selectors we tried, like `*>.dropdown::after`, did not undo the previous rule */

/* Set overflow:hidden on the wrapper to clip the native select's arrow, this clips hte outline too so focus styles are less than ideal in FF */
_::-moz-progress-bar, body:last-child .dropdown {
  overflow: hidden;
}
/* Show only the custom icon */
_::-moz-progress-bar, body:last-child .dropdown:after {
  display: block;
}
_::-moz-progress-bar, body:last-child .dropdown select {
  /* increase padding to make room for menu icon */
  padding-right: 1.9em;
  /* `window` appearance with these text-indent and text-overflow values will hide the arrow FF up to v30 */
  -moz-appearance: window;
  text-indent: 0.01px;
  text-overflow: "";
  /* for FF 30+ on Windows 8, we need to make the select a bit longer to hide the native arrow */
  width: 110%;
}

/* At first we tried the following rule to hide the native select arrow in Firefox 30+ in Windows 8, but we'd rather simplify the CSS and widen the select for all versions of FF since this is a recurring issue in that browser */
/* @supports (-moz-appearance:meterbar) and (background-blend-mode:difference,normal) {
.dropdown select { width:110%; }
}   */


/* Firefox 7+ focus style - This works around the issue that -moz-appearance: window kills the normal select focus. Using semi-opaque because outline doesn't handle rounded corners */
_::-moz-progress-bar, body:last-child .dropdown select:focus {
  outline: 2px solid rgba(180,222,250, .7);
}


/* Opera - Pre-Blink nix the custom arrow, go with a native select button */
x:-o-prefocus, .dropdown::after {
  display:none;
}


/* Hover style */
.faq-dropdown:hover {
  border:1px solid #888;
}

/* Focus style */
select:focus {
  outline:none;
  box-shadow: 0 0 1px 3px rgba(180,222,250, 1);
  background-color:transparent;
  color: #222;
  border:1px solid #aaa;
}


/* Firefox focus has odd artifacts around the text, this kills that */
select:-moz-focusring {
  color: transparent;
  text-shadow: 0 0 0 #000;
}

option {
  font-weight:normal;
}


/* These are just demo button-y styles, style as you like */
.faq-dropdown-btn {
  border: 1px solid #bbb;
  border-radius: .3em;
  box-shadow: 0 1px 0 1px rgba(0,0,0,.04);
  background: #f3f3f3; /* Old browsers */
  background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%); /* FF3.6+ */
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e5e5e5)); /* Chrome,Safari4+ */
  background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); /* Chrome10+,Safari5.1+ */
  background: -o-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); /* Opera 11.10+ */
  background: -ms-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); /* IE10+ */
  background: linear-gradient(to bottom, #ffffff 0%,#e5e5e5 100%); /* W3C */
}

.output {
  margin: 0 auto;
  padding: 1em; 
}

.accordionfaq-toggle {
        cursor: pointer;
        font-size: 1.1em;
        font-weight: 700;
        text-align: left;
        border-radius: 3px;
        padding: 19px 19px 19px 60px;
        border: 1px solid #CCC;
        box-shadow: 0 0 5px rgba(0, 0, 0, .19), 0 3px 3px rgba(0, 0, 0, .23);
        background: #FFF;
        border-radius: 3px;
    }
.accordionfaq-toggle:active {
        border-bottom: none;
    }
    
    .accordionfaq-content {
        display: none;
        border-radius: 3px;
        border: 1px solid #CCC;
        border-top: 0 !important;
        background: #FFF;
        box-shadow: 0 0 5px rgba(0, 0, 0, .19), 0 3px 3px rgba(0, 0, 0, .23);
        margin: -87px 0 19px 0;
        padding: 4em 3em 3em 4em;
    }
    
    .accordionfaq-content>p {
        margin-top: 2.5em;
    }
              
            
!

JS

              
                $(function() {
  $('#faqDrodpown').change(function(){
    $('.faqs').hide();
    $('#' + $(this).val()).show();
  });
  
  $('#accordion-faq').find('.accordionfaq-toggle').click(function() { /*Expand or collapse this panel*/
        $(this).next().slideToggle('fast');
        $(".accordionfaq-content").not($(this).next()).slideUp('fast');
    });
});
              
            
!
999px
We're stronger <u>nited than <div>ided.

Console