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

              
                <p>
  Browsers before <code>type="module"</code> represent less than 5% of the worldwide market (<a target="_blank" href="https://gs.statcounter.com/">statcounter, Mar 2020</a>)
  — <em>should you still support these users</em>?<br />
  What is the complexity in your build system for this (rapidly shrinking) 5%?
</p>
<p class="cta">
  &rarr; Read more about differential serving on <a target="_blank" href="https://v8.dev/features/modules#browser">v8.dev</a>
</p>

<table>
  <thead>
    <tr>
      <th>Modules</th>
      <td>Chrome<sup>1</sup></td>
      <td>Edge</td>
      <td>Safari</td>
      <td>Firefox</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>Shipped</th>
      <td class="yes">🛥️💨</td>
      <td class="yes">🛥️💨</td>
      <td class="yes">🛥️💨</td>
      <td class="yes">🛥️💨</td>
    </tr>
    <tr>
      <th><code>&lt;script type="module"&gt;</code></th>
      <td>61</td>
      <td>16</td>
      <td>10.1</td>
      <td>60</td>
    </tr>
    <tr>
      <th><code>&lt;script nomodule&gt;</code></th>
      <td>61</td>
      <td>16</td>
      <td>11<sup>2</sup></td>
      <td>60</td>
    </tr>
  </tbody>
  <thead>
    <tr>
      <th>Native features available&hellip;</th>
      <td>Chrome</td>
      <td>Edge</td>
      <td>Safari</td>
      <td>Firefox</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>ES6 support (<a target="_blank" href="https://kangax.github.io/compat-table/es6/">Kangax</a>)</th>
      <td class="yes">97%</td>
      <td class="yes">96%</td>
      <td class="yes">99%</td>
      <td class="yes">98%</td>
    </tr>
    <tr>
      <th>Promises</th>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
    </tr>
    <tr>
      <th><code>window.fetch</code></th>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
    </tr>
    <tr>
      <th>Async/Await</th>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
    </tr>
    <tr>
      <th>Dynamic Import<sup>3</sup></th>
      <td class="really">63</td>
      <td class="really">Edgium<sup>4</sup></td>
      <td class="really">11</td>
      <td class="really">67</td>
    </tr>
    <tr>
      <!-- this isn't really to do with JS? -->
      <th><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties">CSS Variables</a></th>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
    </tr>
    <tr>
      <th>CSS Grid</th>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
      <td class="yes">✔️</td>
    </tr>
    <tr>
      <th>Custom Elements</th>
      <td class="yes">✔️</td>
      <td class="really">Edgium<sup>4</sup></td>
      <td class="yes">✔️</td>
      <td class="really">63<sup>5</sup></td>
    </tr>
    <tr>
      <th>Shadow DOM</th>
      <td class="yes">✔️</td>
      <td class="really">Edgium<sup>4</sup></td>
      <td class="yes">✔️</td>
      <td class="really">63<sup>5</sup></td>
    </tr>
  </tbody>
</table>

<ul>
  <li><strong>1</strong> Includes Chromium-based browsers</li>
  <li><strong>2</strong> Without <a target="_blank" href="https://gist.github.com/samthor/64b114e4a4f539915a95b91ffd340acc">this snippet</a> or similar, Safari 10.1 will execute both scripts</li>
  <li><strong>3</strong> Dynamic import can be <a target="_blank" href="https://gist.github.com/samthor/3ff82bd5b11314fec2e1826d4a96ce7c">trivially</a> <a target="_blank" href="https://github.com/GoogleChromeLabs/dynamic-import-polyfill">polyfilled</a> after build</li>
  <li><strong>4</strong> Edge 16-18 (predating Chromium Edge) has about 1.5% market share</li>
  <li><strong>5</strong> Firefox 61-62 has less than 0.04% combined market share</li>
</ul>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Roboto+Slab:100,300,400,700');

a {
  text-decoration: none;
  color: blue;
  
  &:hover {
    text-decoration: underline;
  }
}

em {
  font-style: italic;
}

sup {
  transform: translateY(-10%) scale(0.6);
  display: inline-block;
  opacity: 0.5;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-flow: column;
  min-height: 100vh;
  font-family: 'Roboto Slab', 'Arial', sans-serif;
  font-variant-numeric: tabular-nums;
  line-height: 1.5em;
  font-size: 14px;
  margin: 1em;
}

p, ul {
  max-width: 500px;
}

p {
  margin: 0 0.5em 1.25em;
  text-align: center;
  
  &.cta {
    background: #eee;
    border-radius: 12px;
    padding: 8px;
  }
}

ul {
  margin-top: 1.25em;
  color: #333;
  li {
    margin-bottom: 0.75em;
    text-indent: -1.5ch;
  }
  
  strong {
    color: #999;
    font-weight: bold;
  }
}

table {
  line-height: 2em;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 2px fadeout(black, 75%);
}

thead {
  color: white;
  background: #777;
  td {
    width: 120px;
    background: #333;
  }
}

th {
  text-align: left;
  width: 240px;
  padding: 0 12px;
}

td {
  text-align: center;
}
tbody td {
  background: #f0f0f9;
}
  
code {
  font-family: monospace;
}

td.yes {
  background: #B5FFAE;
}

td.really {
  background: #ffebae;
}
              
            
!

JS

              
                
              
            
!
999px

Console