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.


                <h1>Hello world</h1>

<p>This is a demo for the <a href="">constructible style sheet polyfill</a>.</p>

<form id="color" autocomplete="off">
    <label for="selectTextColor">Select text color</label>
    <input type="color" name="selectTextColor" id="selectTextColor" required>
    <label for="font">Choose font family</label>
    <input type="text" id="font" name="font" list="fonts">
    <datalist id="fonts">
      <option value="Helvetica">
      <option value="Arial">
      <option value="Fira Code">
      <option value="Operator Mono">
      <option value="Courier">
      <option value="Papyrus">
      <option value="Verdana">
      <option value="Times New Roman">
  <button>Change that stylesheet</button>



                label {
  display: block;

input {
  margin-bottom: 1rem;


                import '';

/** Demo code */
const bgPurple = new CSSStyleSheet();
const everythingTomato = new CSSStyleSheet();

bgPurple.replace(`h1 { background: purple; }`);
everythingTomato.replace(`* { color: tomato; }`);

document.adoptedStyleSheets = [everythingTomato, bgPurple];

document.querySelector('form').addEventListener('submit', event => {
  const color = document.querySelector('[name="selectTextColor"]').value || '#000000';
  const fontFamily = document.querySelector('[name="font"]').value || 'Times New Roman';
    * {
      color: ${color};
      font-family: "${fontFamily}";

class TestEl extends HTMLElement {
  constructor() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.adoptedStyleSheets = [bgPurple];
  connectedCallback() {
    this.shadowRoot.innerHTML = `<h1>Shadow DOM, y'all</h1>`;
    setTimeout(() => {
      this.shadowRoot.adoptedStyleSheets = [];
    }, 3000)

customElements.define('test-el', TestEl);

const c = new TestEl