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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


  <div class="wrapper">
    <article class="flow">
      <div class="demo flow">
        <h1>My heading with teal margin</h1>
          A paragraph of text that has margin on it. The margin is blue so you can see
        Set heading’s bottom margin
        <input type="range" value="2" min="2" max="10" />
      <figure class="callout">
          Set the heading element’s bottom margin with the slider to see how the
          margin collapse changes.


                .demo h1 {
  margin-bottom: var(--heading-margin, 2rem);

.demo p {
  margin-top: 3rem;

/* Presentational styles */
.callout {
  max-width: 500px;

.demo h1,
.demo p {
  position: relative;

.demo p {
  outline: 2px solid var(--color-stroke);
  outline-offset: -2px;
  padding: 0.5rem;

.demo h1::before,
.demo p::before {
  content: "";
  display: block;
  width: 100%;
  position: absolute;
  left: 0;

.demo h1::before {
  height: var(--heading-margin, 2rem);
  top: 100%;
  background: #00c9db;

.demo p::before {
  bottom: 100%;
  height: 3rem;
  background: #3740ff;

label {
  display: flex;
  gap: 1rem;



                const slider = document.querySelector('[type="range"]');
const demo = document.querySelector('.demo');

slider.addEventListener('input', ({target}) =>'--heading-margin', `${target.value}rem`)