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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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.


                <!DOCTYPE html>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Constructible Stylesheet</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <h1 id="header">Hokages</h1>
    <p>The gifted Hokages are highlighted in the list below:</>
      <li class="gifted">Minato Namikaze</li>
      <li>Tobirama Senju</li>
      <li class="gifted">Hatake Kakashi</li>
      <li>Hiruzen Sarutobi</li>
      <li class="gifted">Hashirama Senju</li>
      <li>Uzumaki Naruto</li>
    <button onClick="update()">Update shared sheet</button><br/>
    <button onClick="appendWithConcat()">Append new sheet with concat()</button><br/>
    <button onClick="appendWithSpread()">Append new sheet with spread</button><br/>




                const sheet = new CSSStyleSheet();
let clicks = 0;
sheet.replaceSync('.gifted { color: blueviolet } button { background: blueviolet; color: white }');
document.adoptedStyleSheets = [sheet];

const update = () => {
  switch(clicks) {
    case 1:
      sheet.replaceSync('.gifted { color: green } button { background: green; color: white }');
    case 2:
      sheet.replaceSync('.gifted { color: red } button { background: red; color: white }');
    case 3:
      sheet.replaceSync('.gifted { color: yellow } button { background: yellow; color: white }');
      sheet.replaceSync('.gifted { color: cadetblue } button { background: cadetblue; color: white }');

const appendWithConcat = () => {
  const newSheet = new CSSStyleSheet();
  newSheet.replaceSync('h1 { color: maroon } p { color: gainsboro }');
  document.adoptedStyleSheets = document.adoptedStyleSheets.concat(newSheet);

const appendWithSpread = () => {
  const newSheet = new CSSStyleSheet();
  newSheet.replaceSync('h1 { color: cadetblue } p { color: blueviolet }');
  document.adoptedStyleSheets = [...document.adoptedStyleSheets, newSheet];