Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <label>
  <span class="color"></span>
  <span class="size"></span>
  <datalist id="tickmarks">
    <option value="0" label="0">
    <option value="1">
    <option value="2">
    <option value="3">
    <option value="4">
    <option value="5" label="5">
    <option value="6">
    <option value="7">
    <option value="8">
    <option value="9">
    <option value="10" label="10">
  </datalist>
  <input id="font-size" type="range" min="0" max="10" step="0.05" value="2" list="tickmarks">
</label>

<p class="help">Use the slider to set the font size. Use arrow keys for more precise control.</p>

<div id="text">As the text gets larger it also gets lighter. So, smaller text has higher contrast for greater accessibility and larger text is less oppressive.</div>

              
            
!

CSS

              
                body {
  background-color:#eee;
  font-family:sans-serif;
}

.color {
  float:right;
}

input[type=range] {
  width:100%;
}

.help {
  color:#757575;
}

#text {
  background-color:#fff;
  border:solid 1px currentColor;
  border-radius:.25em;
  font-family:serif;
  padding:.5em;
}

datalist {
  color:#757575;
  display:flex;
  font-size:.75em;
  margin-top:1em;
  justify-content:space-between;
}
              
            
!

JS

              
                var fs = document.getElementById('font-size'),
    size = document.querySelector('.size'),
    color = document.querySelector('.color'),
    txt = document.getElementById('text');

function scaleRGB() {
  var rgbVal = Math.round(fs.value * 25.5 * 0.9);
  return 'rgb(' + rgbVal + ',' +  rgbVal + ',' + rgbVal + ')';
}

function getFontSize() {
  var fontSize = fs.value + 'em',
      rgb = scaleRGB();
  txt.style.fontSize = fontSize;
  txt.style.color = rgb;
  size.innerHTML = fontSize;
  color.innerHTML = rgb;
}

fs.addEventListener('change', getFontSize);

getFontSize();
              
            
!
999px

Console