Pen Settings



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


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


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.


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.


                <div class="accordion">
  <a href="#">Item 1
    <span>Description of Item 1</span>
  <a href="#">Item 2
    <span>Description of Item 2</span>
  <a href="#">Item 3
    <span>Description of Item 3 <br>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</span>
    <a href="#">Item 4
    <span>Description of Item 4</span>

<div class="about">
  <p>While making a squarespace site my client neded an accordion FAQ feature... which squarespace doesn't have in September, 2021. </p>
  <p>I've made a few pure CSS accordions before, but I didn't want to hand off complex code to "normie" clients. This is my attempt at making a PureCSS accordion with the cleanest HTML possible. I'm assuming that the CSS is hidden and won't be touched by the client.


.accordion{margin:2em 10vw;}
.accordion a{display:block; padding:10px; background:#DDF; font-size:1.5em; text-decoration:none; color:#669; margin-bottom:2px;}
.accordion a:before{content: "+"; float:right; font-size:1.5em; font-weight:700; margin:-.3em .5em -1em 0; ;}
.accordion a span{display:block; font-size:.7em; background:#FFF; overflow:hidden; max-height:0; transition:.3s; padding:0 20px; margin:10px -10px -10px -10px;}
.accordion a:focus{color:#000; background:#EEF;}
.accordion a:focus:before{content: "";}
.accordion a:focus span{max-height:80vh; transition:1.2s;}
.accordion span:before, .accordion span:after{content:""; display:block; height:20px;}

.about{margin:2em; background:#EEE; width:40vw; margin:auto; padding:2em;}