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 is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.


CC-BY-SA 4.0
(c) 2017 NamePros
This work by Paul Buonopane at NamePros is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

<div id="license">
<a rel="license" href=""><img alt="Creative Commons License" style="border-width:0" src="" /></a><br />This <span xmlns:dct="" href="" rel="dct:type">work</span> by <span xmlns:cc="" property="cc:attributionName">Paul Buonopane at NamePros</span> is licensed under a <a rel="license" href="">Creative Commons Attribution-ShareAlike 4.0 International License</a>.

<dl id="config">
  <dt><label for="width">Width</label></dt>
  <dd><input id="width"  type="number" value="1" min="1" required></dd>
  <dt><label for="height">Height</label></dt>
  <dd><input id="height" type="number" value="1" min="1" required></dd>
<dl id="output">
  <dt><label for="code">Code</label></dt>
  <dd><pre id="code"></pre></dd>
  <dt><label for="preview">Preview</label></dt>
  <dd><p class="note">The actual image is transparent, but its background color has been set to blue for the preview.</p><img id="preview"></dd>


                :root {
  font-family: 'Open Sans', sans-serif;
  font-size: 14pt;
  content-sizing: border-box;

#license {
  float: right;
  max-width: 300px;
  text-align: center;

.note {
  font-size: .8em;
  color: #444;

label::after {
  content: ':';

dl:not(:last-child) {
  margin-bottom: 2em;
  dt {
    font-weight: inherit;

  dd {
    margin: 0 0 1em;
    padding: 0;

input[type=number] {
  text-align: right;
  font-family: monospace;
  width: 4em;
  font-size: inherit;

#config {
  --line-height: 1.4rem;
  line-height: var(--line-height);
#config * {
  /*outline: 1px solid rgba(0, 0, 255, .5);/* */
  #config dt {
    float: left;
    padding-right: .4em;
    min-width: 3.3em;
  #config input {
    padding: 0 .2em;
    height: var(--line-height);
    line-height: inherit;
    background: none transparent;
    outline: 0 none;
    border: 0 none;
    border-bottom: 2px solid #bbb;
    transition: border-bottom-color .5s;
    #config input:hover,
    #config input:focus {
      outline: 0 none;
      border-bottom-color: #555;
    #config input:focus {
      background-color: #eee;
  #config > * > * {
    display: inline-block;
    vertical-align: middle;

pre {
  padding: .5em;
  .ready {
    cursor: pointer;
    .ready:hover {
      background-color: #eee;

#preview {
  background-color: blue;
  display: block;


                const urlPrefix = 'data:image/svg+xml;base64,';
const max = 4096;

var $preview = document.getElementById('preview');
var $code    = document.getElementById('code');

$code.addEventListener('click', event => {
$code.title = 'Click to select';

document.querySelectorAll('#config input').forEach($input => {
  $input.addEventListener('input', update);


function update() {
  var width  = 0 + document.getElementById('width').value;
  var height = 0 + document.getElementById('height').value;
  if (width < 1 || height < 1 || width > max || height > max) {
  var code =
      urlPrefix +
      btoa(`<svg xmlns="" width="${width}" height="${height}"/>`);
  $preview.src = code;
  $code.textContent = code;

function selectCode() {
  if (!$code.hasChildNodes()) {
  var selection = window.getSelection();
  $code.childNodes.forEach(node => {
    if (node instanceof Text) {
      var range = document.createRange();