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 is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.


                <h1>Accordion Container Element Demo</h1>
<p>An accessible <a href="">Custom Element</a> wrapper that adds accordion functionality with keyboard support to a group of headings and panels.</p>

  <h2 data-summary>Summary one</h2>
  <div data-panel>One content</div>
  <h2 data-summary>Summary two</h2>
  <div data-panel>Two content</div>
  <h2 data-summary>Summary three</h2>
  <div data-panel>Three content</div>


                * {
  box-sizing: border-box;

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.5;
  margin: 0;
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
  color: #171922;

accordion-container {
  display: block;
  margin-top: 4rem;

[data-summary] {
  margin: 0;

[data-summary] > button {
  background-color: transparent;
  border: none;
  cursor: pointer;
  display: block;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.1; 
  padding: 1rem 1.5rem;
  width: 100%;
  text-align: left;
  position: relative;

[data-summary]:not(:first-child) {
  border-top: 1px solid #eeeeee;

[data-summary] > button::before {
  content: "";
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8dGl0bGU+QXJ0Ym9hcmQgMTwvdGl0bGU+CiAgPHBvbHlsaW5lIHBvaW50cz0iNC41IDE1IDExLjUgOCA0LjUgMSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4K");
  background-repeat: no-repeat;
  width: 1rem;
  height: 1rem;
  display: block;
  position: absolute;
  left: 0;
  top: 1rem;

[data-summary] > button[aria-expanded="true"]::before {
  transform: rotate(90deg);

[data-summary] > button:hover {
  background-color: #eeeeee;

[data-summary] > button:focus {
  outline: 2px dashed #2858e3;
  outline-offset: 2px;

[data-panel] {
  padding: 1rem .5rem;

h1 {
  font-weight: 500;
  line-height: 1.2;


                import '';