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.

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

              
                  <div class="demo">
  <div class="demo__canvas">
    <div class="demo__wrapper">
      <div id="box-to-model">
        <div class="background"></div>
      </div>
    </div>
  </div>
  <div class="demo__controls">
    <div class="demo__group-container">
      <div class="group">
        <label for="width">
          <span class="label">width:</span>
          <select id="width">
            <option value="auto">auto</option>
            <option value="50px">50px</option>
            <option value="100px" >100px</option>
            <option value="150px">150px</option>
            <option value="200px" selected>200px</option>
            <option value="250px">250px</option>
            <option value="500px">500px</option>
          </select>
        </label>

        <label for="height">
          <span class="label">height:</span>
          <select id="height">
            <option value="auto">auto</option>
            <option value="50px">50px</option>
            <option value="100px">100px</option>
            <option value="150px">150px</option>
            <option value="200px" selected>200px</option>
            <option value="250px">250px</option>
            <option value="500px">500px</option>
          </select>
        </label>

        <label for="max-width">
          <span class="label">max-width:</span>
          <select id="max-width">
            <option value="auto">auto</option>
            <option value="50px">50px</option>
            <option value="100px">100px</option>
            <option value="150px">150px</option>
            <option value="200px">200px</option>
            <option value="250px">250px</option>
            <option value="500px">500px</option>
          </select>
        </label>

        <label for="max-height">
          <span class="label">max-height:</span>
          <select id="max-height">
            <option value="auto">auto</option>
            <option value="50px">50px</option>
            <option value="100px">100px</option>
            <option value="150px">150px</option>
            <option value="200px">200px</option>
            <option value="250px">250px</option>
            <option value="500px">500px</option>
          </select>
        </label>
      </div>

      <div class="group">
        <label for="box-sizing">
          <span class="label">box-sizing:</span>
          <select id="box-sizing">
            <option value="content-box">content-box</option>
            <option value="border-box">border-box</option>
          </select>
        </label>
        <label for="padding">
          <span class="label">padding:</span>
          <select id="padding">
            <option value="0px">0px</option>
            <option value="10px">10px</option>
            <option value="25px">25px</option>
            <option value="50px">50px</option>
            <option value="100px">100px</option>
          </select>
        </label>

        <label for="border">
          <span class="label">border:</span>
          <select id="border">
            <option value="none">none</option>
            <option value="4px solid var(--cyan)">4px solid cyan</option>
            <option value="8px solid var(--purple)">8px solid purple</option>
            <option value="16px solid var(--pink)">16px solid pink</option>
            <option value="32px solid var(--red)">32px solid red</option>
          </select>
        </label>

        <label for="margin">
          <span class="label">margin:</span>
          <select id="margin">
            <option value="0px">0px</option>
            <option value="10px" selected>10px</option>
            <option value="25px">25px</option>
            <option value="50px">50px</option>
            <option value="100px">100px</option>
          </select>
        </label>
      </div>

      <div class="group">
        <label for="border-radius">
          <span class="label">border-radius:</span>
          <select id="border-radius">
            <option value="0px">0px</option>
            <option value="5px">5px</option>
            <option value="10px">10px</option>
            <option value="25px">25px</option>
            <option value="50px">50px</option>
            <option value="100px">100px</option>
            <option value="150px">150px</option>
            <option value="200px">200px</option>
            <option value="250px">250px</option>
            <option value="500px">500px</option>
          </select>
        </label>

        <label for="outline">
          <span class="label">outline:</span>
          <select id="outline">
            <option value="none">none</option>
            <option value="4px solid var(--cyan)">4px solid cyan</option>
            <option value="8px dotted var(--purple)">8px dotted purple</option>
            <option value="16px dashed var(--pink)">16px dashed pink</option>
            <option value="32px solid var(--red)">32px solid red</option>
          </select>
        </label>

        <label for="outline-offset">
          <span class="label">outline-offset:</span>
          <select id="outline-offset">
            <option value="0px">0px</option>
            <option value="5px">5px</option>
            <option value="10px">10px</option>
            <option value="25px">25px</option>
            <option value="50px">50px</option>
          </select>
        </label>

        <label for="box-shadow">
          <span class="label">box-shadow:</span>
          <select id="box-shadow">
            <option value="none">none</option>
            <option value="0 0 4px 2px var(--cyan)">0 0 4px 2px cyan</option>
            <option value="0 0 8px 4px var(--purple)">0 0 8px 4px purple</option>
            <option value="0 0 16px 8px var(--pink)">0 0 16px 8px pink</option>
            <option value="0 0 32px 16px var(--red)">0 0 32px 16px red</option>
          </select>
        </label>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600&display=swap');

html {
  --background: hsla(180, 100%, 0%, 1);
  --text-color: hsla(180, 100%, 90%, .75);
  --purple: hsla(240, 90%, 60%, 1);
  --background2: hsla(240, 75%, 90%, .75);
  --color2: hsla(240, 80%, 10%, 1);
  --pink: hsla(300, 90%, 60%, 1);
  --background3: hsla(300, 75%, 90%, .75);
  --color3: hsla(300, 80%, 10%, 1);
  --red: hsla(0, 90%, 60%, 1);
  --background4: hsla(0, 75%, 90%, .75);
  --color4: hsla(0, 80%, 10%, 1);
  --cyan: hsla(180, 90%, 60%, 1);
  --background5: hsla(180, 75%, 90%, .75);
  --color5: hsla(180, 80%, 10%, 1);
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  height: 100%;
}

body {
  background: var(--background);
  color: #fff;
  font-family: 'Open Sans', sans-serif;
}

.demo {
  display: grid;
  grid-template-columns: 100vw;
  grid-template-rows: 80vh 1fr;
  overflow: hidden;
}

@media (min-width: 800px) {
  .demo {
    grid-template-columns: calc(100vw - 320px) 320px;
    grid-template-rows: auto;
  }
}

@media (min-width: 1200px) {
    .demo {
      grid-template-columns: calc(100vw - 640px) 640px;
  }
}

select {
  font-family: 'Open Sans', sans-serif;
}

.demo__canvas {
  background: var(--color5);
  height: 80vh;
  text-align: center;
  padding: 20px;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

@media (min-width: 800px) {
  .demo__canvas {
    height: 100vh;
  }
}

.demo__wrapper {
  background: hsla(0, 0%, 50%, .5);
  border-radius: 5px;
}

#box-to-model {
  color: #000;
  background: #fff;
  margin: 10px;
  padding: 10px;
}

.demo__controls {
  background: var(--background);
  box-sizing: border-box;
  height: 100vh;
  overflow: visible;
  position: relative;
  transition: transform 250ms ease-out;
}

.demo__group-container {
  display: flex;
  flex-wrap: wrap;
  box-sizing: border-box;
  justify-content: center;
  overflow: auto;
  margin: 10px 0;
  padding: 0 10px 10px;
  height: calc(100vh - 20px);
}

.group {
  background: #fff;
  color: #333;
  border-radius: 10px 0 10px 0;
  padding: 10px 20px;
  margin: 0 10px 20px;
  min-width: 200px;
  max-width: 100%;
  flex-grow: 1;
  flex-basis: 200px;
  mix-blend-mode: hard-light;
  max-width: 300px;
}

.group:nth-child(1) {
  --group-dark: var(--color2);
  --group-light: var(--background2);
  background: var(--group-light);
}

.group:nth-child(2) {
  --group-dark: var(--color3);
  --group-light: var(--background3);
  background: var(--group-light);
}
.group:nth-child(3) {
  --group-dark: var(--color4);
  --group-light: var(--background4);
  background: var(--group-light);
}
.group:nth-child(4) {
  --group-dark: var(--color5);
  --group-light: var(--background5);
  background: var(--group-light);
}

.label {
  display: block;
  padding-bottom: 8px;
  color: white;
  pointer-events: none;
}

label:hover .label,
label:focus .label {
   mix-blend-mode: soft-light;
}

label {
  display: block;
  font-size: 18px;
  line-height: 24px;
  margin-bottom: 20px;
  position: relative;
}

select {
  box-sizing: border-box;
  border-radius: 5px 0 5px 0;
  cursor: pointer;
  font-size: 18px;
  line-height: 24px;
  border: 0;
  border-top: 1px solid var(--group-dark);
  border-left: 1px solid var(--group-dark);
  padding: 8px 32px 8px 8px;
  width: 100%;
  -webkit-appearance: none;
  -moz-appearance: none;
  mix-blend-mode: multiply;
  transition: transform 100ms ease-out;
  box-shadow: 0px 2px 1px 1px var(--group-dark);
}

select:hover,
select:focus{
  transform: scale(1.05);
  mix-blend-mode: overlay;
  box-shadow: 0px 2px 2px 2px var(--group-dark);
}

label::after {
  content: '';
  position: absolute;
  font-size: 18px;
  line-height: 24px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--group-dark); 
  right: 10px;
  bottom: 15px;
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* Demo Specific Overrides */
.demo__canvas {
  background: var(--color3);
}

#box-to-model {
  overflow: hidden;
  transition: all 750ms ease-out;
}

.background {
  width: 100%;
  min-height: 100%;
  background: var(--background3);
}

              
            
!

JS

              
                // set our box and controls as globals
const box = document.getElementById('box-to-model');
const controls = [...document.querySelectorAll('select')];
const demoContainer = document.querySelector('.demo__wrapper');
const controlsContainer = document.querySelector('.demo__controls');

init();

// bind our change events and set initial properties
function init() {
  controls.map(bindChangeEvents);
  updateProperties();
}

// set updateProperties to run when a control changes
function bindChangeEvents(control) {
  control.addEventListener('change', updateProperties);
}

// when a property changes, set the box's style with a string
function updateProperties() {
  box.style = controls.reduce(stringifyProperties, "");
}

// convert properties and values from controls to a single string
function stringifyProperties(string, control) {
  const declaration = `${control.id}: ${control.value};`;
  return `${string} ${declaration}`;
}
              
            
!
999px

Console