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.

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.


                <div class="tools">
  <label for="font-picker-size">Font size</label>
  <input type="range" id="font-picker-size" value="125" min="80" max="300">
  <label for="color-picker-primary">Primary Color</label>
  <input type="color" id="color-picker-primary" value="#b30027">
  <label for="color-picker-contrast">Contrast Color</label>
  <input type="color" id="color-picker-contrast" value="#ffffff">

<div class="template">
  <div class="primary--fill masthead">
    <h1 class="contrast--text">Using CSS Custom Properties and the CSSOM to create real time theme previews</h1>
  <div class="body">
    <h2 class="primary--text">
      My themed page
     <p>Bacon ipsum dolor amet swine t-bone leberkas, pork belly strip steak tongue shankle bresaola ball tip ribeye ham pork loin ham hock. Pork belly capicola ground round t-bone chicken doner beef ribs tail pork chop tenderloin swine flank ham. Jerky sirloin tongue <a class="primary--text" href="#">spare ribs t-bone</a> shoulder short ribs chuck frankfurter. Shoulder pig capicola landjaeger beef ribs, pork loin short ribs jerky salami cupim. Beef ribs bacon tongue, ribeye short loin turducken swine sirloin porchetta capicola picanha ball tip cupim shank frankfurter. Shank bacon biltong, flank beef turkey porchetta sausage meatloaf pastrami shankle tenderloin spare ribs short ribs pork belly.</p>

    <a class="button primary--fill contrast--text" href="#">Button</a>

    <p>Bresaola bacon shank salami pancetta drumstick andouille shoulder capicola hamburger corned beef prosciutto t-bone chuck. <a class="primary--text" href="#">Biltong sausage boudin, brisket turducken</a> doner venison landjaeger salami picanha tri-tip pork belly spare ribs short ribs. Turkey pork belly shoulder boudin tail, beef pork loin ground round spare ribs ribeye tri-tip landjaeger bresaola. Cow shankle rump tail. Ground round ham hock capicola landjaeger sausage. Ribeye pig meatball, spare ribs pancetta capicola doner salami.</p>


                :root {
  --theme-contrast: #ffffff;
  --theme-primary: #b30027;
  --theme-font-size: 125%;
  --unsupported-message-display: none;

.template {
  font-size: var(--theme-font-size);

.primary--text {
  color: var(--theme-primary);

.primary--fill {
  background-color: var(--theme-primary);

.contrast--text {
  color: var(--theme-contrast);

.contrast--fill {
  background-color: var(--theme-contrast);

body {
  font: 100% / 1.5 Georgia;
  margin: 0;
  margin: 0;

p {
  margin: 3em 0;

.masthead {
  padding: 12% 2em;
  text-align: center;
  background-image: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.3));

.body {
  margin: auto;
  max-width: 760px;
  padding: 2em;

.button {
  margin: 0;
  padding: .5em 2em;
  border-radius: .25em;
  text-decoration: none;
  box-shadow: 0 .1em .2em 0em rgba(0,0,0,0.5);
  border-bottom: .15em solid rgba(0,0,0,0.25);

.button:hover {
  background-image: linear-gradient(

.tools {
  position: fixed;
  background: rgba(255,255,255,.75);
  padding: 1em;
  margin: .5em;
  border-radius: .25em;
  max-width: 20em;

.tools > * {
  display: inline-block;

.tools label {
  min-width: 9em;
  max-width: 11em;


                let primaryColorPicker = document.getElementById('color-picker-primary');
let contrastColorPicker = document.getElementById('color-picker-contrast');
let fontSizePicker = document.getElementById('font-picker-size');

function setThemeVar(name, value, unit) {
  let rootStyles = document.styleSheets[0].cssRules[0].style;
  rootStyles.setProperty('--theme-' + name, value + (unit || ''));

primaryColorPicker.addEventListener('input', function(e){

contrastColorPicker.addEventListener('input', function(e){

fontSizePicker.addEventListener('input', function(e){
  setThemeVar('font-size',, '%');