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

              
                <main>
  <div>
    <h2>Content Editable</h2>
    <div class="card" contenteditable>
    <header>
      <h1>Animated Armor</h1>
      <h2>Medium construct, unaligned</h2>
    </header> <!-- creature heading -->
    <hr>
    <dl>
      <dt>Armor Class</dt>
      <dd>18 (plate)</dd>
      <dt>Hit Points</dt>
      <dd>66 (12d8 + 12)</dd>
      <dt>Speed</dt>
      <dd>30 ft., swim 30 ft.</dd>
    </dl>
    <hr>
    <div class="abilities">
      <div>
        <h4>STR</h4>
        14 (+2)
      </div>
      <div>
        <h4>DEX</h4>
        11 (+0)
      </div>
      <div>
        <h4>CON</h4>
        13 (+1)
      </div>
      <div>
        <h4>INT</h4>
        1 (-5)
      </div>
      <div>
        <h4>WIS</h4>
        3 (-4)
      </div>
      <div>
        <h4>CHA</h4>
        1 (-5)
      </div>
    </div>
    <hr>
    <dl>
      <dt>Damage Immunities</dt>
      <dd>poison, psychic</dd>
      <dt>Condition Immunities</dt>
      <dd>blinded, charmed, deafened, exhaustion, frightened, petrified, poisoned</dd>
      <dt>Senses</dt>
      <dd>blindsight 60 ft. (blind beyond this radius), passive Perception 6</dd>
      <dt>Languages</dt>
      <dd>&mdash;</dd>
      <dt>Challenge</dt>
      <dd>1 (200 XP)</dd>
    </dl>
    <hr>
    <dl class="-dark">
      <dt>Antimagic susceptibility.</dt>
      <dd>
        The armor is incapacitated while in the area of an <i>antimagic
        field</i>.  If targeted by <i>dispel magic</i>, the armor must succeed
        on a Constitution saving throw against the caster’s spell save DC or
        fall unconscious for 1 minute.
      </dd>
      <dt>False Appearance.</dt>
      <dd>
        While the armor remains motionless, it is indistinguishable from a normal suit of armor.
      </dd>
    </dl>

    <h3>Actions</h3>
    <dl class="-dark">
      <dt>Multiattack.</dt>
      <dd>The armor makes two melee attacks.</dd>
      <dt>Slam.</dt>
      <dd>
        <i>Melee Weapon Attack:</i> +4 to hit, reach 5 ft., one target.
        <i>Hit:</i> 5 (1d6 + 2) bludgeoning damage.
      </dd>
    </dl>
  </div>
  </div>
  <div>
    <h2>Generated Image</h2>
    <div class="render"></div>
  </div>
  <div>
    <h2>Controls</h2>
    <p>
      Edit the content in the first column (it's contenteditable), then click 'Render' to generate an image version that can be shared.
    </p>
    <button>Render</button>
  </div>
  
</main>
<link href="https://fonts.googleapis.com/css?family=Libre+Baskerville:700" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans:400,700,400italic,700italic" rel="stylesheet" type="text/css">
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

:root {
  --bg: #fdf1dc;
  --top: #e69a28;
  --primary: #922610;
  --secondary: #540803;
  --width: 280px;
}

body {
  font-size: 13.5px;
  line-height: 1.4;
  margin: 1rem;
  font-family: sans-serif;
}
main {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  grid: auto / var(--width) 1fr 1fr;
  gap: 1rem;
  align-items: start;
  justify-items: start;
}

.card {
  display: inline grid;
  width: var(--width);
  background: var(--bg);
  padding: 0 .625rem;
  
  &::after,
  &::before {
    content: '';
    height: .25rem;
    border: 1px solid var(--secondary);
    display: block;
    margin: 0 -.625rem;
    background: var(--primary);
  }
  
  &::before {
    margin-bottom: .25rem;
  }
  
  &::after {
    margin-top: 1rem;
  }
  
  h1, h2, h3, h4, h5, h6 {
    margin: 0;
    line-height: 1.2;
    color: var(--secondary);
  }
  h1 {
    font-family: serif;
    font-variant: small-caps;
    font-weight: bold;
    line-height: 1;
  }
  h1 + h2 {
    font-weight: normal;
    font-variant: normal;
    color: black;
    font-size: .75rem;
    font-style: italic;
  }
  
  h3 {
    font-weight: normal;
    letter-spacing: 1px;
    font-variant: small-caps;
    font-size: 1.25rem;
    border-bottom: 1px solid var(--secondary);
    color: var(--primary);
    padding: .5rem 0 0;
    margin-bottom: .5rem;
  }
  
  h4 {
    font-size: .875rem;
  }
  
  hr {
    background: var(--primary);
    height: .375rem;
    width: 100%;
    border: 0;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
  }
  
  dl {
    color: var(--primary);
    margin: 0;
    
    &.-dark {
      color: black;
      
      dt {
        color: inherit;
        font-style: italic;
      }
      
      dd {
        margin-left: 0;
        margin-bottom: .5rem;
      }
    }
  }
  
  dt {
    font-weight: bold;
    color: var(--secondary);
    float: left;
    margin-right: .25rem;
  }
  
  dd {
    margin-bottom: .25rem;
    margin-left: 1rem;
  }
  
  .abilities {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    justify-items: center;
    text-align: center;
    font-size: .75rem;
    color: var(--primary);
  }
}
              
            
!

JS

              
                import domToImage from "https://esm.sh/dom-to-image";

document.querySelector('button').addEventListener('click', function() {
  domToImage.toPng(
    document.querySelector('.card')
  )
  .then(function (dataUrl) {
        var img = new Image();
        img.src = dataUrl;
        const el = document.querySelector('.render')
        el.innerHTML = ''
        el.appendChild(img)
    })
})
              
            
!
999px

Console