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.

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.

HTML

              
                <dl class="css-accordion">
  <dt id="first"><a href="#first">First heading</a></dt>
  <dd>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus facilisis tellus id diam tempus scelerisque. Nullam vel nisl magna. Vivamus sem arcu, imperdiet vitae arcu nec, condimentum aliquam enim. Proin pharetra erat non metus faucibus facilisis. Aenean id posuere magna, vel interdum felis. Morbi vulputate ligula sed dapibus ullamcorper. Nulla sed turpis sit amet augue ornare maximus vel et nunc. Praesent efficitur neque nec bibendum tempus. Sed quis urna velit. Vestibulum consequat semper augue, quis lobortis felis malesuada id. Donec commodo, justo vehicula rutrum facilisis, massa eros sodales mi, ac scelerisque massa ligula nec risus. Aliquam erat volutpat. Cras vestibulum enim orci, quis pretium diam mattis non.</p>
  </dd>
  <dt id="second"><a href="#second">Second heading</a></dt>
  <dd>
    <p>In hac habitasse platea dictumst. Sed pretium ex ut ex tempor, eget sollicitudin magna molestie. Maecenas commodo commodo mattis. Maecenas sit amet ligula turpis. Fusce tincidunt justo in lectus malesuada sollicitudin ut ut enim. Vivamus ac nisi magna.</p>
  </dd>
  <dt id="third"><a href="#third">And the final heading</a></dt>
  <dd>
    <p>Ut interdum ullamcorper tincidunt. Quisque feugiat, magna eu tincidunt scelerisque, lectus augue lobortis est, mattis consectetur velit quam a lacus. Mauris eu ligula sapien. Quisque mattis bibendum imperdiet. Nulla facilisi. Nulla euismod, nibh porttitor viverra ornare, justo massa laoreet tortor, at gravida diam orci eget quam. Vivamus vestibulum tristique sollicitudin.</p>
  </dd>
</dl>
              
            
!

CSS

              
                $base: 5px;
$grey: silver;

body {
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
}

.css-accordion {
  border: 1px solid $grey;
  border-radius: $base;
  margin: 0 auto;
  max-width: $base*100;
  dt {
    background: $grey;
    a {
      color: #000;
      display: block;
      padding: $base*2;
      text-decoration: none;
    }
    &:not(:last-of-type) {
      border-bottom: 1px solid rgba(0,0,0,0.1);
    }
    &:last-of-type {
      border-radius: 0 0 $base $base;
    }
    &:target {
      &:last-of-type {
        border-radius: 0;
      }
      + dd {
        display: block;
      }
    }
    &:first-child {
      border-radius: $base $base 0 0;
    }
  }
  dd {
    display: none;
    margin: 0;
    padding: 0;
    p {
      margin: 0;
      padding: $base*2;
    }
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console