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

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.

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.

HTML

            
              mixin card(color, title, text)
  article.card(style="--card-header-color:" + color)
    h2= title
    p= text
      block

header
  h1 CSS Vars Demo
  .controls
    label Columns
      input(type="range" data-prop="--main-columns" min="1" max="3" value="3")
    label Font size
      input(type="range" data-prop="--main-font-size" data-unit="px" min="8" max="16" value="12")

main
  +card("#FF998C", "Themes", "These buttons updates page color, but not card's")
    br
    button.theme(data-prop="--root-background-color" value="#ccc") Light
    button.theme(data-prop="--root-background-color" value="#444") Dark
  +card("#FFEFE5", "Did you know?", "The markup was done using pug, which is a rich template engine for Node.js.")
  +card("#FFE16D", "Columns", "Change columns slider to change cards size 📐")
  +card("#D7FFAA", "Did you know?", "Every valid CSS stylesheet is a valid SCSS file with the same meaning.")
  +card("#9FE0FF", "Font size", "This other slider updates the font size of these cards 𝓐")
  +card("#A49EFF", "Did you know?", "ECMAScript is the “proper” name for the language commonly referred to as JavaScript")

footer
  p Copyright &copy; 2018
            
          
!

CSS

            
              :root {
  --root-background-color: #ccc;
  --main-columns: 3;
  --main-font-size: 12px;
  --card-header-color: white;
  --card-body-color: white;
  --gutter: 8px;
}

body {
  background-color: var(--root-background-color);
}

header, footer {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)) var(--root-background-color);
  min-height: 60px;
  align-items: center;
  color: white;
  text-shadow: 1px 1px rgba(0,0,0,0.5), -1px 1px rgba(0,0,0,0.5), 1px -1px rgba(0,0,0,0.5), -1px -1px rgba(0,0,0,0.5);
}

header {
  padding: var(--gutter) calc(var(--gutter) * 4);
  
  h1 {
    display: inline-block;
  }
}

.controls {
  float: right;
  display: inline-block;
  padding-top: 18px;
  
  label {
    display: block;
  }
}

footer {
  display: flex;
  
  p {
    margin: 0 auto;
  }
}

main {
  columns: var(--main-columns);
  font-size: var(--main-font-size);
  padding: var(--gutter) 0;
}

.card {
  background-color: var(--card-body-color);
  min-height: 120px;
  margin-bottom: var(--gutter);
  
  h2 {
    background-color: var(--card-header-color);
    margin: 0;
  }
  
  h2, p {
    padding: var(--gutter) calc(var(--gutter) * 2);
  }
}
            
          
!

JS

            
              app = () => {
  const eventHandler = event =>
    document.documentElement.style.setProperty(
      event.target.dataset.prop,
      `${event.target.value}${event.target.dataset.unit || ''}`
    );

  document
    .querySelectorAll('input[type="range"]')
    .forEach(input => input.addEventListener('input', eventHandler));

  document
    .querySelectorAll('button.theme')
    .forEach(input => input.addEventListener('click', eventHandler));
};

window.addEventListener('load', app);

            
          
!
999px

Console