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

              
                Click into this demo (without opening any sections) then use in-page-find to search for a word, such as "ginger":
<div class="section collapsed">
  <h2 class="title">Introduction</h1>
    <div hidden="until-found" class="details">Green tea ginger lemongrass agave green tea guacamole summer fruit salad fruit smash pumpkin orange zesty tofu pad thai roasted butternut squash blueberry chia seed jam green papaya salad.</div>
</div>

<div class="section collapsed">
  <h2 class="title">Thesis</h1>
    <div hidden="until-found" class="details">Picnic chia seeds kale caesar salad elderberry fall Thai curry mocha chocolate appetizer mediterranean vegetables cranberry chickpea spritzer potato mediterranean luxury bowl edamame lemongrass citrusy crumbled lentils.</div>
</div>

<div class="section collapsed">
  <h2 class="title">Conclusion</h1>
    <div hidden="until-found" class="details">Oranges chili pepper delightful blueberry scones chickpea crust pizza cozy cinnamon oatmeal second course crispy iceberg lettuce tempeh. Quinoa flatbread arugula salad with earl grey latte strawberries leek blueberry pops golden cayenne pepper Italian pepperoncini shaved almonds salted picnic salad hemp seeds cilantro tahini drizzle cherry bomb mangos alfalfa sprouts spring.</div>
</div>
              
            
!

CSS

              
                body {
  font-family: system-ui, sans-serif;
  margin: 1em auto;
  max-width: 60em;
  padding: 1em;
}

.title {
  cursor: pointer;
}
.title::before {
  content: "⬇️ ";
}
.collapsed > .title::before {
  content: "➡️ ";
}

.details {
  max-width: 40em;
}

              
            
!

JS

              
                document.querySelectorAll(".section").forEach((section) => {
  section.onbeforematch = () => {
    section.classList.remove("collapsed");
  };
  section.querySelector(".title").onclick = () => {
    section.classList.toggle("collapsed");

    const details = section.querySelector(".details");
    if (section.classList.contains("collapsed")) {
      details.hidden = "until-found";
    } else {
      details.removeAttribute("hidden");
    }
  };
});

              
            
!
999px

Console