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

              
                <section class="accordion">
  <details open>
    <summary>CSS-only Accordion</summary>
    <p>Using the &lt;details&gt; element</p>
    <p>And no unnecessary DOM</p>
  </details>
  <details>
    <summary>Animated open-close</summary>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla mollis consectetur iaculis. Fusce vestibulum pulvinar est. Fusce faucibus aliquet purus hendrerit efficitur. Phasellus ante urna, mattis et ligula eu, venenatis vulputate ex. Fusce quis enim aliquam, finibus mi vel, sagittis urna. Morbi in enim placerat, sagittis ante vitae, ultrices nisl. Duis molestie quis ante vitae rhoncus. Integer ultricies libero ut efficitur sagittis. Vestibulum euismod pharetra ligula, eget bibendum turpis gravida non. Curabitur pulvinar nulla id porttitor vehicula. Vivamus efficitur est sed lectus commodo, in facilisis magna vehicula. Sed in massa nunc. Praesent sodales neque nec lectus auctor, id faucibus libero malesuada. Fusce tempus, diam quis consequat efficitur, erat justo pretium massa, et vehicula risus lectus non quam. Nam faucibus luctus metus vitae malesuada.</p>
  </details>
  <details>
    <summary>Even put images in them</summary>
    <img src="https://images.unsplash.com/photo-1513006666308-523b5f33c3dd?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2592&q=80" />
  </details>
  <details>
    <summary>Woops, no content!</summary>
  </details>
</section>
              
            
!

CSS

              
                details > summary:focus {
  outline: none;
}
details > summary::-webkit-details-marker {
  display: none;
}
details > summary {
  list-style: none;
  border: solid 1px teal;
  border-radius: 0.5rem;
}
details[open] > summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
details[open] > :not(summary) {
  border-left: solid 1px teal;
  border-right: solid 1px teal;
}
details[open] > :last-child {
  border-bottom: solid 1px teal;
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}
details > summary::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border: solid 2px black;
  border-left-color: transparent;
  border-bottom-color: transparent;
  margin-right: 0.6rem;
  transition: transform 0.2s;
  transform: rotate(-45deg) translate(-20%, 20%);
}
details[open] > summary::before {
  transform: rotate(135deg) translate(-20%, 20%);
}

/* layout */
section.accordion {
  max-width: 400px;
  width: 100%;
  padding: 10px; 
}
details {
  padding: 10px;
}
details > * {
  width: 100%;
  padding: 10px;
  margin: 0px;
}
              
            
!

JS

              
                
              
            
!
999px

Console