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

              
                <details>
  <summary>
    What can I put in here?
  </summary>

  <p>
    You can put whatever you want! Here's an example of a list:
  </p>
  
  <ul>
    <li>This is a great feature</li>
    <li>It is accessible out-of-the-box</li>
    <li>No need for a JavaScript library</li>
    <li>Plus you can style it with CSS</li>
  </ul>
</details>

<!-- Shameless plug 😉 -->
<a class="twitter" href="https://twitter.com/KeenanPayne_" title="Follow me on Twitter" target="_blank">
    <img src="https://assets.codepen.io/174608/twitter.svg" />
</a>
              
            
!

CSS

              
                body {
  padding-left: 3rem;
  padding-right: 3rem;
  width: 100%;
}

details {
  --shadow: hsla(0, 0%, 0%, 0.05);
  --shadow-light: hsla(0, 0%, 95%, 0.1);
  --shadow-dark: hsla(0, 0%, 0%, 0.055);
  
  background-color: white;
  border-radius: 10px;
  box-sizing: border-box;
  transition: box-shadow 500ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 225ms cubic-bezier(0.45, 0, 0.55, 1);
  width: 100%;
  
  @media (min-width: 560px) {
    margin-left: auto;
    margin-right: auto;
    max-width: 600px;
  }
  
  &:hover {
    box-shadow: -6px -6px 12px var(--shadow-light, transparent), 
                6px 6px 12px var(--shadow, transparent);
  }
  
  &:active {
    box-shadow: -4px -4px 8px var(--shadow-light, transparent), 
                4px 4px 8px var(--shadow, transparent);
  }
  
  &:active {
    transform: scale(.995);
  }
  
  // Open state
  &[open] {
    box-shadow: -12px -12px 24px var(--shadow-light, transparent), 
                12px 12px 24px var(--shadow, transparent);
    border: 1px solid var(--shadow-dark);
  }
  
  // Subsequent details
  + details {
    margin-top: 24px;
  }
  
  // Descendants
  > summary {
    cursor: pointer;
    font-weight: 400;
    // Hiding outline for aesthetics, shifting the focus state
    // to the <details>, but reconsider depending on your 
    // approach to accessibility
    outline: none;
    padding: 1.25rem 1.5rem;
  }
  
  > p,
  > ul {
    color: #666;
    font-size: .875rem;
    line-height: 1.6;
    margin-top: 0;
  }
  
  > p { 
    margin-bottom: 0;
    padding: 0 1.5rem .5rem;
  }
  
  > ul {
    padding-bottom: 1rem;
    padding-left: 3rem;
  }
}

// You can update the triangle to be whatever you would
// like by using the following code:
details > summary {
  // list-style: none;
  
  &::-webkit-details-marker {
    // display: none; 
  }
}


//
// Demo Styles
// -----------

:root {
  align-items: center;
  background-color: #f7f8fc;
  display: flex;
  font-family: 'Inter', sans-serif;
  justify-content: center;
  min-height: 100vh;
  
  @supports (font-variation-settings: normal) {
    font-family: 'Inter var', sans-serif;
  }
}

.twitter { 
  bottom: 0;
  position: fixed;
  right: 0;
  width: 50px;
}
              
            
!

JS

              
                /**
 * Goodbye JavaScript
 * You are no longer needed
 * At least for today
 * 😉
 */
              
            
!
999px

Console