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

              
                <!--Header-->
<div class="header">
  <h1>Simple CSS Accordion</h1>
  <p>Learn how to create an accordion element on your website without any knowledge of JavaScript.</p>
</div>

<!--Accordion 1-->
<details>
  <summary class="accordion">What is an accordion?</summary>
  
  <div class="accordionDrop">What you just did was click on an accordion. Essentially, an accordion is a graphical control element comprising a vertically stacked list of of items that can be expanded or collapsed to reveal content.</div>
</details>

<!--Accordion 2-->
<details>
  <summary class="accordion">What do you use an accordion for?</summary>
  
  <div class="accordionDrop">An accordion is great for hiding information that you only want to be display when a user is interested. For example: Using an accordion is great on a frequently asked questions page, especially if you have a bunch of questions!</div>
</details>

<!--Accordion 3-->
<details>
  <summary class="accordion">I still need help!</summary>
  
  <div class="accordionDrop">I'm always open to helping you out. If you wish to contact me, my <a href="http://twitter.com/techjohnson">Twitter</a> is always open!</div>
</details>
              
            
!

CSS

              
                body {
  font-family: poppins, sans-serif;
  padding: 0;
  margin: 0;
  background: #F7F8FB;
}

.header {
  background: #5391F2;
  color: white;
  height: auto;
  text-align: center;
  padding: 100px 0;
}

/* Accordion CSS for white dropdown */
.accordion {
  background: white;
  border: 1px solid #EDEDED;
  border-radius: 5px;
  font-weight: 700;
  margin: 10px;
  padding: 10px 20px;
  cursor: pointer;
}

.accordionDrop {
  padding: 0px 30px;
}

::-webkit-details-marker { 
  display: none;
}
              
            
!

JS

              
                
              
            
!
999px

Console