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

              
                  <div class="page">
    <header>
      <h1>Styling disclosure widgets</h1>
    </header>
    <main>
      <details>
        <summary>
          <h2>How can I add some (very) basic styles?</h2>
        </summary>
        <div>
          <p>For starters, you might like to add a background color to your summary element, and then a border of the same color around the entirety of everything else. This ties the contents together, visually.</p>
          <p>In order to get a border around the entirety of your non-summary content, put it all in a div (or some other containing element you deem appropriate):</p>
          
<pre><code>&lt;details&gt;
  &lt;summary&gt;
    &lt;h3&gt;Here is your summary content&lt;/h3&gt;
  &lt;/summary&gt;
  &lt;div&gt;
    &lt;p&gt;We've put all our other content in a containing div.&lt;/p&gt;
    &lt;p&gt;This way, we can put a border around (or otherwise style) this container.&lt;/p&gt;
  &lt;/div&gt;
&lt;/details&gt;</code></pre>
          
        </div>
      </details>
    </main>
  </div>
              
            
!

CSS

              
                *,
*:before,
*:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  height: 100vh;
  margin: 0 auto;
  max-width: 60rem;
  padding: 0 .5rem;
}

header, main {
  margin: 1rem 0;
}

main *+* {
  margin-top: 1rem;
}

/* Styling the Disclosure Widgets */

details > summary {
  background-color: #fdb;
  cursor: pointer;
  padding: .5rem 1rem;
}

details > summary > * {
  display: inline;
}

details > div {
  border: 2px solid #fdb;
  margin-top: 0;
  padding: 1rem;
}
              
            
!

JS

              
                
              
            
!
999px

Console